-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersperformanceMake DataFusion fasterMake DataFusion faster
Description
Is your feature request related to a problem or challenge?
One form of Case statements look like
CASE
WHEN <expr> THEN <expr>
WHEN <expr> THEN <expr>
...
ELSE
ENDAs suggested by @geoffreyclaude in #17448 (comment)
Any WHEN false will never execute and thus can be removed from the
For example
CASE
WHEN false THEN 1 -- never executed
ELSE 2
ENDCould be simplified to
2Likewise
CASE
WHEN x=y THEN 1
WHEN false THEN 2 -- never executed
ELSE 3
ENDCould be simplified to
CASE
WHEN x=y THEN 1
ELSE 3
ENDDescribe 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:
datafusion/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
Lines 1398 to 1400 in ec4413e
| // | |
| // Rules for Case | |
| // |
An example is In #17450 where @EeshanBembi implemented a new CASE simplification
Additional context
_No response_¯
geoffreyclaude
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersperformanceMake DataFusion fasterMake DataFusion faster