feat[expr]: N-ary CASE WHEN expression#6197
feat[expr]: N-ary CASE WHEN expression#6197lukekim wants to merge 11 commits intovortex-data:developfrom
Conversation
…13) * feat: implement binary CASE WHEN expression with support for nested conditions
|
Sorry we just merged a break: #6081. We will be updating the PR very soon with a migration |
joseph-isaacs
left a comment
There was a problem hiding this comment.
One little one otherwise looks good.
Thanks for this
|
Looks like the merge was a little off |
* N-ary * fix: update threshold and value literals in n-ary CASE WHEN benchmark * refactor: streamline context creation in benchmarks and improve test readability
Signed-off-by: Luke Kim <80174+lukekim@users.noreply.github.com>
joseph-isaacs
left a comment
There was a problem hiding this comment.
thanks for this. 2 tiny changes and we can go
Merging this PR will improve performance by 33.5%
Performance Changes
Comparing Footnotes
|
| if options.num_when_then_pairs == 0 { | ||
| vortex_bail!("CaseWhen must have at least one WHEN/THEN pair"); | ||
| } | ||
|
|
||
| // The return dtype is based on the first THEN expression (index 1) | ||
| let then_dtype = &arg_dtypes[1]; |
There was a problem hiding this comment.
This looks wrong.
I would think the dtype is the union of the nullability or then conditions with the nullability of else (or nulllable if there is not else).
Adds support for the "CASE WHEN" SQL expression to the Vortex expression system, including its conversion from DataFusion, benchmarking, and pushdown logic. The main focus is on enabling CASE WHEN expressions to be parsed, converted, and benchmarked, while ensuring only supported forms are handled.
Support for CASE WHEN expressions:
case_whentovortex-array's expression system and re-exported its functions, enabling construction and evaluation of CASE WHEN and nested CASE WHEN expressions. (vortex-array/src/expr/exprs/mod.rs) [1] [2]CaseWhenexpression in theExprSessionso it can be used in expression evaluation. (vortex-array/src/expr/session.rs) [1] [2]DataFusion integration and conversion:
CaseExprto Vortex's nestedcase_whenexpressions, with validation to only support the "searched CASE" form (not "simple CASE"). (vortex-datafusion/src/convert/exprs.rs) [1] [2] [3]vortex-datafusion/src/convert/exprs.rs) [1] [2]Benchmarks and protocol updates:
vortex-array/benches/expr/case_when_bench.rs,vortex-array/Cargo.toml) [1] [2]vortex-proto/proto/expr.proto)Bench: