Alex Behm has posted comments on this change.

Change subject: IMPALA-5211: Simplifying conditionals (istrue, nullif, etc.)
......................................................................


Patch Set 4:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/7829/4/fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java
File fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java:

Line 160:     if (expr.getChildren().size() == 1) {
> Yep, you're right. I'll remove this code, update comments to indicate that 
Before you add those existing tests to ExprRewriteRulesTest, please take a look 
at expr-test.cc to see whether there is already sufficient coverage there (my 
suspicion is yes, but better to check). The entire expr-test.cc is run with and 
without constant folding.


Line 220:    * Simplifies nullif(a, b) when a and b are identical
> I'm not sure what you mean by your suggestion "...deal with NullLiteral cas
Sorry I got confused by the nullif() semantics, my suggestion with special 
casing the NullLiteral does not make sense.

How about the following solution:
1. Convert nullif() to IF(x <=> y, x, NULL). Remove the BE implementation, 
leave the tests. Note that IF(x=y, NULL, x) is not a correct transformation 
because NULL=NULL -> NULL
2. Enhance the existing IF simplification to deal with the specific case above 
(you can use expr.equals() just in the same way you would have here).


-- 
To view, visit http://gerrit.cloudera.org:8080/7829
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id91ca968a0c0be44e1ec54ad8602f91a5cb2e0e5
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Philip Zeyliger <[email protected]>
Gerrit-Reviewer: Alex Behm <[email protected]>
Gerrit-Reviewer: Matthew Jacobs <[email protected]>
Gerrit-Reviewer: Philip Zeyliger <[email protected]>
Gerrit-HasComments: Yes

Reply via email to