Details
-
Improvement
-
Status: Open
-
Trivial
-
Resolution: Unresolved
-
Impala 3.0
-
None
-
None
-
ghx-label-3
Description
A trivial optimization is to omit ELSE if it adds no value:
CASE WHEN id = 10 THEN id ELSE NULL END
The ELSE case defaults to null if not provided, so the above can be rewritten to:
CASE WHEN id = 10 THEN id END
Also, the simplification can omit the trailing WHEN clause if it returns NULL. For example:
CASE WHEN id = 0 THEN 10 WHEN id = 1 THEN NULL END
Should be simplified to:
CASE WHEN id = 0 THEN 10 END
Attachments
Issue Links
- is part of
-
IMPALA-7747 Clean up the Expression Rewriter
- Open