Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-14050

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

    XMLWordPrintableJSON

Details

    Description

      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
      ## ] 

      Attachments

        Issue Links

          Activity

            People

              lidavidm David Li
              icook Ian Cook
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m