Jefffrey opened a new issue, #5828:
URL: https://github.com/apache/arrow-datafusion/issues/5828

   ### Describe the bug
   
   Given case expression in following form:
   
   ```sql
   CASE
     WHEN x1 THEN y1
     WHEN x2 THEN y2
     ELSE y3
   END
   ```
   
   Then 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:
   
   ```bash
   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 by https://github.com/apache/arrow-datafusion/pull/5820


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to