impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Zeyliger (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-5211: Simplifying ifnull/isnull/nvl where conditional is a literal.
Date Fri, 25 Aug 2017 02:24:56 GMT
Philip Zeyliger has posted comments on this change.

Change subject: IMPALA-5211: Simplifying ifnull/isnull/nvl where conditional is a literal.

Patch Set 4:

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

Line 106:    * NULL value or if the child is a literal.
> NULL is also a literal, so just saying literal is enough

Line 111:     if (child0 instanceof NullLiteral) {
> single line

Line 115:       Preconditions.checkState(!(child0 instanceof NullLiteral));
> remove Preconditions, and single line (the Precondition is trivially true h

Note that I changed instanceof LiteralExpr to isLiteral(). That seems to be more consistent
with other code. (They do the same thing.)
File fe/src/test/java/org/apache/impala/analysis/

Line 296:     RewritesOk("ifnull(null, id)", rule, "id");
> unfortunately, we don't cover this case for some of the other functions, bu

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

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

Line 389:     RewritesOk(
> please also add a similar case with ifnull here

I didn't loop this one through all the variants.

To view, visit
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: I9e4b8bf6fedd595f9ea54ffb30fc71a058c7f16c
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Philip Zeyliger <>
Gerrit-Reviewer: Alex Behm <>
Gerrit-Reviewer: Dan Hecht <>
Gerrit-Reviewer: Henry Robinson <>
Gerrit-Reviewer: Matthew Jacobs <>
Gerrit-Reviewer: Philip Zeyliger <>
Gerrit-HasComments: Yes

View raw message