Philip Zeyliger has posted comments on this change. Change subject: IMPALA-5211: Simplifying ifnull/isnull/nvl where conditional is a literal. ......................................................................
Patch Set 4: (7 comments) http://gerrit.cloudera.org:8080/#/c/7781/4/fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java File fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java: Line 106: * NULL value or if the child is a literal. > NULL is also a literal, so just saying literal is enough Done. Line 111: if (child0 instanceof NullLiteral) { > single line Done Line 115: Preconditions.checkState(!(child0 instanceof NullLiteral)); > remove Preconditions, and single line (the Precondition is trivially true h Done Note that I changed instanceof LiteralExpr to isLiteral(). That seems to be more consistent with other code. (They do the same thing.) http://gerrit.cloudera.org:8080/#/c/7781/4/fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java File fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java: Line 296: RewritesOk("ifnull(null, id)", rule, "id"); > unfortunately, we don't cover this case for some of the other functions, bu Done I used "null" as the last argument for RewritesOk for these, since that means "not simplified". Line 298: RewritesOk("nvl(null, id)", rule, "id"); > how about ifnull(null, null), though clearly the test framework handles tha Done I don't know what you mean by ambiguous, but I added the case. PS4, Line 296: RewritesOk("ifnull(null, id)", rule, "id"); : RewritesOk("isnull(null, id)", rule, "id"); : RewritesOk("nvl(null, id)", rule, "id"); : RewritesOk("ifnull(id, id + 1)", rule, null); : : RewritesOk("ifnull(1, 2)", rule, "1"); : RewritesOk("ifnull(0, id)", rule, "0"); > +1 Done. Line 389: RewritesOk( > please also add a similar case with ifnull here Done. I didn't loop this one through all the variants. -- To view, visit http://gerrit.cloudera.org:8080/7781 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9e4b8bf6fedd595f9ea54ffb30fc71a058c7f16c Gerrit-PatchSet: 4 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Philip Zeyliger <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Dan Hecht <[email protected]> Gerrit-Reviewer: Henry Robinson <[email protected]> Gerrit-Reviewer: Matthew Jacobs <[email protected]> Gerrit-Reviewer: Philip Zeyliger <[email protected]> Gerrit-HasComments: Yes
