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

[C++] Add a general "if, ifelse, ..., else" kernel ("CASE WHEN")

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0
    • C++

    Description

      ARROW-10640 added a ternary if_else kernel. Add another kernel that extends this concept to an arbitrary number of conditions and associated results, like a vectorized if-ifelse-...-else with an arbitrary number of ifelse and with the else optional. This is like a SQL CASE statement.

      How best to achieve this is not obvious. To enable SQL-style uses, it would be most efficient to implement this as a variadic kernel where the even-number arguments (0, 2, ...) are the arrays of boolean conditions, the odd-number arguments (1, 3, ...) are the corresponding arrays of results, and the final argument is the else result. But I'm not sure if this is practical. Maybe instead we should implement this to operate on listarrays, like NumPy's np.where or np.select.

      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 - 9h 20m
                  9h 20m