calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [18/50] [abbrv] calcite-avatica git commit: [CALCITE-1691] ClassCastException in RelOptUtil.containsNullableFields, attempting to convert executor to RexExecutorImpl
Date Thu, 30 Mar 2017 21:38:08 GMT
[CALCITE-1691] ClassCastException in RelOptUtil.containsNullableFields, attempting to convert
executor to RexExecutorImpl


Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/46672b41
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/46672b41
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/46672b41

Branch: refs/heads/master
Commit: 46672b41fdb0c0aedb30d0ec7158d138d36222d5
Parents: 785c2fb
Author: Julian Hyde <jhyde@apache.org>
Authored: Fri Mar 10 11:24:30 2017 -0800
Committer: Julian Hyde <jhyde@apache.org>
Committed: Fri Mar 10 12:02:12 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/calcite/plan/RelOptUtil.java    | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/46672b41/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
index b5d3cb3..7655290 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
@@ -62,6 +62,7 @@ import org.apache.calcite.rex.LogicVisitor;
 import org.apache.calcite.rex.RexBuilder;
 import org.apache.calcite.rex.RexCall;
 import org.apache.calcite.rex.RexCorrelVariable;
+import org.apache.calcite.rex.RexExecutor;
 import org.apache.calcite.rex.RexExecutorImpl;
 import org.apache.calcite.rex.RexFieldAccess;
 import org.apache.calcite.rex.RexInputRef;
@@ -3320,6 +3321,11 @@ public abstract class RelOptUtil {
    * Determines whether any of the fields in a given relational expression may
    * contain null values, taking into account constraints on the field types and
    * also deduced predicates.
+   *
+   * <p>The method is cautious: It may sometimes return {@code true} when the
+   * actual answer is {@code false}. In particular, it does this when there
+   * is no executor, or the executor is not a sub-class of
+   * {@link RexExecutorImpl}.
    */
   private static boolean containsNullableFields(RelNode r) {
     final RexBuilder rexBuilder = r.getCluster().getRexBuilder();
@@ -3343,10 +3349,14 @@ public abstract class RelOptUtil {
       // declared NULL are really NOT NULL.
       return true;
     }
-    RexExecutorImpl rexImpl =
-        (RexExecutorImpl) r.getCluster().getPlanner().getExecutor();
+    final RexExecutor executor = r.getCluster().getPlanner().getExecutor();
+    if (!(executor instanceof RexExecutorImpl)) {
+      // Cannot proceed without an executor.
+      return true;
+    }
     final RexImplicationChecker checker =
-        new RexImplicationChecker(rexBuilder, rexImpl, rowType);
+        new RexImplicationChecker(rexBuilder, (RexExecutorImpl) executor,
+            rowType);
     final RexNode first =
         RexUtil.composeConjunction(rexBuilder, predicates.pulledUpPredicates,
             false);


Mime
View raw message