hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jd...@apache.org
Subject [18/27] hive git commit: HIVE-13102: CBO: Reduce operations in Calcite do not fold as tight as rule-based folding (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan) ADDENDUM
Date Fri, 26 Feb 2016 23:16:01 GMT
HIVE-13102: CBO: Reduce operations in Calcite do not fold as tight as rule-based folding (Jesus
Camacho Rodriguez, reviewed by Ashutosh Chauhan) ADDENDUM


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/50781c46
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/50781c46
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/50781c46

Branch: refs/heads/llap
Commit: 50781c460d3669bf2ff34780701341ae62f5ac6d
Parents: 2ddcc38
Author: Jesus Camacho Rodriguez <jcamacho@apache.org>
Authored: Thu Feb 25 17:23:40 2016 +0100
Committer: Jesus Camacho Rodriguez <jcamacho@apache.org>
Committed: Thu Feb 25 17:23:40 2016 +0100

----------------------------------------------------------------------
 .../apache/hadoop/hive/ql/optimizer/calcite/HiveRexUtil.java    | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/50781c46/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRexUtil.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRexUtil.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRexUtil.java
index 6745d79..2f309f3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRexUtil.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRexUtil.java
@@ -193,6 +193,11 @@ public class HiveRexUtil {
           RexCall rightCast = (RexCall) right;
           comparedOperands.add(rightCast.getOperands().get(0));
         }
+        // Assume we have the expression a > 5.
+        // Then we can derive the negated term: NOT(a <= 5).
+        // But as the comparison is string based and thus operands order dependent,
+        // we should also add the inverted negated term: NOT(5 >= a).
+        // Observe that for creating the inverted term we invert the list of operands.
         RexCall negatedTerm = negate(rexBuilder, call);
         if (negatedTerm != null) {
           negatedTerms.add(negatedTerm);


Mime
View raw message