2010YOUY01 opened a new issue, #12814: URL: https://github.com/apache/datafusion/issues/12814
### Describe the bug See the reproducer in datafusion-cli (compiled from the latest main, commit 84c940978) ```shell > CREATE TABLE t1(v1 int); > SELECT v1 FROM t1 WHERE ((count(v1) % 1) << 1) > 0; thread 'main' panicked at /Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/datafusion/physical-expr/src/expressions/binary/kernels.rs:87:1: called `Option::unwrap()` on a `None` value note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -- Backtrace ...... 22: datafusion_expr::logical_plan::tree_node::<impl datafusion_expr::logical_plan::plan::LogicalPlan>::map_expressions at /Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/datafusion/expr/src/logical_plan/tree_node.rs:570:19 23: datafusion_optimizer::simplify_expressions::simplify_exprs::SimplifyExpressions::optimize_internal at /Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs:125:9 24: <datafusion_optimizer::simplify_expressions::simplify_exprs::SimplifyExpressions as datafusion_optimizer::optimizer::OptimizerRule>::rewrite at /Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs:73:9 ....... ``` ### To Reproduce _No response_ ### Expected behavior The query is invalid, given aggregate function is not allowed in where clause, so it should return a planning error, instead of panics ### Additional context Found by SQLancer https://github.com/apache/datafusion/issues/11030 -- 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: github-unsubscr...@datafusion.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org