Skip to content

[C++] tdigest, quantile return empty arrays when nulls not skipped #29647

@asfimport

Description

@asfimport

This is a C++ kernel issue, but the examples below use the R bindings to call the C++ kernels.

The aggregate functions tdigest and quantile return arrays with the same length as the option value q:

call_function("tdigest", Array$create(c(1, 2, 3, NA)), options = list(q = c(0.1, 0.9), skip_nulls = TRUE))
## Array
## <double>
## [
##   1,
##   3
## ]

But when the data includes null values and the option skip_nulls is set to false, these kernels instead return zero-length arrays:

call_function("tdigest", Array$create(c(1, 2, 3, NA)), options = list(q = c(0.1, 0.9), skip_nulls = FALSE))
## Array
## <double>
## []

This is difficult to handle in bindings; it requires addition of special code to handle the case where the array comes back empty. It would be much better if the returned array in this situation had the same length q with null in every position:

## Array
## <double>
## [
##   null,
##   null
## ] 

Reporter: Ian Cook / @ianmcook
Assignee: David Li / @lidavidm

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-14050. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions