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

[C++] Fix sort_indices, array_sort_indices timestamp support discrepancy

    XMLWordPrintableJSON

Details

    Description

      sort_indices supports sorting by timestamp arrays, but array_sort_indices does not. Here's some example R code to demonstrate this (but this example code depends on ARROW-11703 to run):

      tbl <- tibble::tibble(
        dttm = lubridate::ymd_hms(c("2021-01-01 00:00:00", "1900-01-01 00:00:00")),
      )
      rb <- arrow::record_batch(tbl)
      
      # this fails:
      arrow:::call_function(
        "array_sort_indices",
        rb$dttm,
        options = list(order = F)
      )
      ## Error: NotImplemented: Function array_sort_indices has no kernel matching input types (array[timestamp[us, tz=UTC]])
      
      # this fails because it internally calls array_sort_indices
      arrow:::call_function(
        "sort_indices",
        rb,
        options = list(names = "dttm", orders = 0L)
      )
      ## Error: NotImplemented: Function array_sort_indices has no kernel matching input types (array[timestamp[us, tz=UTC]])
      
      # this succeeds
      arrow:::call_function(
        "sort_indices",
        rb,
        options = list(names = c("dttm", "dttm"), orders = 0L)
      ) 
      ## Array
      ## <uint64>
      ## [
      ##   1,
      ##   0
      ## ]

      Attachments

        Issue Links

          Activity

            People

              lidavidm David Li
              icook Ian Cook
              Votes:
              0 Vote for this issue
              Watchers:
              5 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