Skip to content

[C++] Add a "coalesce" variadic scalar kernel #28837

@asfimport

Description

@asfimport

Add a variadic scalar compute kernel that works like the SQL coalesce function. It should take arbitrarily many inputs of the same or compatible types and process them row-wise, returning the first non-null value in each row, or returning null if there are no non-null values in the row. 

For example, in the case of 3 integer-type input arrays, this would take inputs:

Array<int32>         Array<int32>         Array<int32>
[                    [                    [
  null,                2,                   3,
  4,                   null,                6,
  null,                null,                9,
  null                 null                 null
]                    ]                    ]

and return output:

Array<int32>
[ 
  2,
  4,
  9,
  null
] 

This should accept scalars and recycle their values.

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

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-13136. 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