-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Given case expression in following form:
CASE
WHEN x1 THEN y1
WHEN x2 THEN y2
ELSE y3
ENDThen all xN (x1, x2) should be boolean expressions and should be coerced to a boolean type if not, otherwise throw an error without causing a panic.
To Reproduce
On latest main:
jeffrey:~/Code/arrow-datafusion/datafusion-cli$ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.30s
Running `/media/jeffrey/1tb_860evo_ssd/.cargo_target_cache/debug/datafusion-cli`
DataFusion CLI v21.0.0
❯ select CASE WHEN 1 THEN null ELSE 10 END as col;
thread 'main' panicked at 'WHEN expression did not return a BooleanArray: Internal("could not cast value to arrow_array::array::boolean_array::BooleanArray")', /home/jeffrey/Code/arrow-datafusion/datafusion/physical-expr/src/expressions/case.rs:199:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
jeffrey:~/Code/arrow-datafusion/datafusion-cli$Expected behavior
Should either succeed, or throw error without panic
Additional context
Will be fixed in #5820
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working