impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcel Kornacker (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-1861: Simplify conditionals with constant conditions
Date Sat, 07 Jan 2017 21:29:24 GMT
Marcel Kornacker has posted comments on this change.

Change subject: IMPALA-1861: Simplify conditionals with constant conditions

Patch Set 3:

File fe/src/main/java/org/apache/impala/rewrite/

Line 133:     boolean foundFalseExpr = false;
briefly explain why this is needed (indicates that case can be simplified)

Line 140:         if (caseExpr.isLiteral() && expr.getChild(i).isLiteral()) {
> it looks like expr.hasCaseExpr() && !caseExpr.isLiteral() means you'll neve
one more thing: for 'case [<expr>]' you can remove all 'when null' branches. this applies
even to non-literal case exprs (which won't trigger l159).

Line 144:           whenExpr = analyzer.getConstantFolder().rewrite(pred, analyzer);
> this is a roundabout way to get a boolean value. use FeSupport.evalPredicat
never mind, you need this for the non-const case.
File fe/src/test/java/org/apache/impala/analysis/

Line 239:   public void TestSimplifyConditionalsRule() throws AnalysisException {
for each conditional, also add a test case that doesn't allow any rewrites.

Line 262:     RewritesOk("case 3 when 0 then id when 1 then id + 1 end", rule, "NULL");
> add 'case null'
also add statement with multiple matches.

To view, visit
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: Id70aaf9fd99f64bd98175b7e2dbba28f350e7d3b
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Thomas Tauber-Marshall <>
Gerrit-Reviewer: Alex Behm <>
Gerrit-Reviewer: Marcel Kornacker <>
Gerrit-Reviewer: Thomas Tauber-Marshall <>
Gerrit-HasComments: Yes

View raw message