drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject drill git commit: DRILL-3366: Avoid short circuit of OR expression in CTAS partitioning
Date Thu, 25 Jun 2015 20:14:30 GMT
Repository: drill
Updated Branches:
  refs/heads/master 403dc5cdc -> 4f9ad493e


DRILL-3366: Avoid short circuit of OR expression in CTAS partitioning


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/4f9ad493
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/4f9ad493
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/4f9ad493

Branch: refs/heads/master
Commit: 4f9ad493ee001d92048d35ab7c9f4badb6a8e77f
Parents: 403dc5c
Author: Steven Phillips <smp@apache.org>
Authored: Wed Jun 24 19:48:25 2015 -0700
Committer: Steven Phillips <smp@apache.org>
Committed: Thu Jun 25 13:13:05 2015 -0700

----------------------------------------------------------------------
 .../apache/drill/exec/expr/fn/impl/BitFunctions.java   |  2 +-
 .../exec/planner/sql/handlers/CreateTableHandler.java  | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/4f9ad493/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java
index c44a6b7..e19f284 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/BitFunctions.java
@@ -34,7 +34,7 @@ import org.apache.drill.exec.expr.holders.IntHolder;
  */
 public class BitFunctions {
 
-  @FunctionTemplate(names = {"booleanOr", "or", "||"},
+  @FunctionTemplate(names = {"booleanOr", "or", "||", "orNoShortCircuit"},
                     scope = FunctionScope.SC_BOOLEAN_OPERATOR,
                     nulls = NullHandling.NULL_IF_NULL)
   public static class BitOr implements DrillSimpleFunc {

http://git-wip-us.apache.org/repos/asf/drill/blob/4f9ad493/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
index 6dda1a6..6910785 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
@@ -38,6 +38,7 @@ import org.apache.calcite.tools.RelConversionException;
 import org.apache.calcite.tools.ValidationException;
 
 import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.exec.physical.PhysicalPlan;
 import org.apache.drill.exec.physical.base.PhysicalOperator;
 import org.apache.drill.exec.planner.logical.CreateTableEntry;
@@ -225,7 +226,17 @@ public class CreateTableHandler extends DefaultSqlHandler {
       compFuncs.add(rexBuilder.makeCall(op, ImmutableList.of(input)));
     }
 
-    return RexUtil.composeDisjunction(rexBuilder, compFuncs, false);
+    return composeDisjunction(rexBuilder, compFuncs);
+  }
+
+  private RexNode composeDisjunction(final RexBuilder rexBuilder, List<RexNode> compFuncs)
{
+    final DrillSqlOperator booleanOrFunc
+             = new DrillSqlOperator("orNoShortCircuit", 2, MajorType.getDefaultInstance(),
true);
+    RexNode node = compFuncs.remove(0);
+    while (!compFuncs.isEmpty()) {
+      node = rexBuilder.makeCall(booleanOrFunc, node, compFuncs.remove(0));
+    }
+    return node;
   }
 
 }
\ No newline at end of file


Mime
View raw message