Description
Another possible simplification for CASE statements that return boolean values.
CASE WHEN p1 THEN e1 WHEN p2 THEN e2 ELSE TRUE END
where e1...en are boolean expressions, can be rewritten into:
(p1 and e1) or (p2 and e2 and not(p1)) or (not(p1) and not(p2))
if p1...pn cannot be nullable.
Attachments
Issue Links
- causes
-
CALCITE-2639 FilterReduceExpressionsRule causes ArithmeticException at execution time
-
- Closed
-
- is blocked by
-
CALCITE-2611 Linq4j code generation failure if one side of an OR contains unknown
-
- Closed
-
- is related to
-
CALCITE-2631 General improvements in case simplification
-
- Closed
-
- links to