[ https://issues.apache.org/jira/browse/IMPALA-7750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Rogers updated IMPALA-7750: -------------------------------- Description: The current FE {{CASE}} rewrite code in {{SimplifyConditionalsRule.simplifyCaseExpr()}} misses some opportunities for optimizations. If these rules are implemented, then the ad-hoc rules for several other functions can be removed. {code:sql} CASE WHEN NULL IS NULL THEN 10 ELSE 20 END {code} Should be rewritten to just {{10}} since the expression is always true. (Currently the expression is not rewritten.) The same issue occurs for the inverse: {code:sql} CASE WHEN 10 IS NULL THEN 10 ELSE 20 END {code} Fix these and we can remove the ad-hoc rules for {{NULLIF}} and aliases in {{rewriteNullIfFn()}}. Also {{nvl2()}} in {{rewriteNvl2Fn}} and {{ifnull()}} in {{rewriteIfNullFn()}}. was: The current FE {{CASE}} rewrite code in {{SimplifyConditionalsRule.simplifyCaseExpr()}} misses some opportunities for optimizations. If these rules are implemented, then the ad-hoc rules for several other functions can be removed. {code:sql} CASE WHEN NULL IS NULL THEN 10 ELSE 20 END {code} Should be rewritten to just {{10}} since the expression is always true. (Currently the expression is not rewritten.) The same issue occurs for the inverse: {code:sql} CASE WHEN 10 IS NULL THEN 10 ELSE 20 END {code} Fix these and we can remove the ad-hoc rules for {{NULLIF}} and aliases in {{rewriteNullIfFn()}}. > Additional FE optimizations for CASE expressions > ------------------------------------------------ > > Key: IMPALA-7750 > URL: https://issues.apache.org/jira/browse/IMPALA-7750 > Project: IMPALA > Issue Type: Improvement > Components: Frontend > Affects Versions: Impala 3.0 > Reporter: Paul Rogers > Priority: Major > > The current FE {{CASE}} rewrite code in > {{SimplifyConditionalsRule.simplifyCaseExpr()}} misses some opportunities for > optimizations. If these rules are implemented, then the ad-hoc rules for > several other functions can be removed. > {code:sql} > CASE WHEN NULL IS NULL THEN 10 ELSE 20 END > {code} > Should be rewritten to just {{10}} since the expression is always true. > (Currently the expression is not rewritten.) > The same issue occurs for the inverse: > {code:sql} > CASE WHEN 10 IS NULL THEN 10 ELSE 20 END > {code} > Fix these and we can remove the ad-hoc rules for {{NULLIF}} and aliases in > {{rewriteNullIfFn()}}. Also {{nvl2()}} in {{rewriteNvl2Fn}} and {{ifnull()}} > in {{rewriteIfNullFn()}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org