### Is your feature request related to a problem or challenge? One form of Case statements look like ```sql CASE WHEN <expr> THEN <expr> WHEN <expr> THEN <expr> ... ELSE END ``` As suggested by @geoffreyclaude in https://github.com/apache/datafusion/issues/17448#issuecomment-3293549174 Any `WHEN false` will never execute and thus can be removed from the For example ```sql CASE WHEN false THEN 1 -- never executed ELSE 2 END ``` Could be simplified to ```sql 2 ``` Likewise ```sql CASE WHEN x=y THEN 1 WHEN false THEN 2 -- never executed ELSE 3 END ``` Could be simplified to ```sql CASE WHEN x=y THEN 1 ELSE 3 END ``` ### Describe the solution you'd like I would like to implement the simplification above ### Describe alternatives you've considered I think we can just extend the existing rules for CASE simplification here: https://github.com/apache/datafusion/blob/ec4413e7d7b41c381c98eda909e5ab650be4c5e5/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L1398-L1400 An example is In https://github.com/apache/datafusion/pull/17450 where @EeshanBembi implemented a new CASE simplification ### Additional context _No response_¯
Activity
alamb commentedon Sep 16, 2025
Since this is well specified and has an example PR I think it is a good first issue
SidChaudhary7 commentedon Sep 16, 2025
take