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-3912: Common subexpression elimination
Date Wed, 04 Nov 2015 06:07:29 GMT
Repository: drill
Updated Branches:
  refs/heads/master bb69f2202 -> b33326ba6


DRILL-3912: Common subexpression elimination

Closes #189


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

Branch: refs/heads/master
Commit: b33326ba625b4cc7dac4adf82745a7a84a462f23
Parents: bb69f22
Author: Steven Phillips <smp@apache.org>
Authored: Wed Oct 7 03:44:10 2015 -0700
Committer: Steven Phillips <smp@apache.org>
Committed: Tue Nov 3 22:06:45 2015 -0800

----------------------------------------------------------------------
 .../expression/ExpressionStringBuilder.java     |   1 -
 .../common/expression/ValueExpressions.java     |   4 +
 .../apache/drill/exec/expr/ClassGenerator.java  |   3 +
 .../apache/drill/exec/expr/EqualityVisitor.java | 324 +++++++++++++++++++
 .../drill/exec/expr/EvaluationVisitor.java      | 319 +++++++++++++++++-
 .../org/apache/drill/exec/expr/HashVisitor.java | 186 +++++++++++
 .../exec/expr/ValueVectorReadExpression.java    |   5 +
 .../physical/impl/aggregate/HashAggBatch.java   |   2 +-
 .../physical/impl/common/ChainedHashTable.java  |   2 +-
 .../physical/impl/filter/FilterRecordBatch.java |   4 +-
 .../impl/project/ProjectRecordBatch.java        |   7 +-
 .../org/apache/drill/TestExampleQueries.java    |   7 +-
 .../org/apache/drill/TestFunctionsQuery.java    |   1 +
 13 files changed, 852 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/common/src/main/java/org/apache/drill/common/expression/ExpressionStringBuilder.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/expression/ExpressionStringBuilder.java b/common/src/main/java/org/apache/drill/common/expression/ExpressionStringBuilder.java
index f301b6e..c29b9b0 100644
--- a/common/src/main/java/org/apache/drill/common/expression/ExpressionStringBuilder.java
+++ b/common/src/main/java/org/apache/drill/common/expression/ExpressionStringBuilder.java
@@ -329,5 +329,4 @@ public class ExpressionStringBuilder extends AbstractExprVisitor<Void, StringBui
     sb.append(e.toString());
     return null;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java b/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
index 4b7314e..2fd8e67 100644
--- a/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
+++ b/common/src/main/java/org/apache/drill/common/expression/ValueExpressions.java
@@ -641,6 +641,10 @@ public class ValueExpressions {
       super(value, pos);
     }
 
+    public String getString() {
+      return value;
+    }
+
     @Override
     protected String parseValue(String s) {
       return s;

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ClassGenerator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ClassGenerator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ClassGenerator.java
index e0c4296..b904fe0 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ClassGenerator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ClassGenerator.java
@@ -153,11 +153,13 @@ public class ClassGenerator<T>{
 
   public void nestEvalBlock(JBlock block) {
     String methodName = getCurrentMapping().getMethodName(BlockType.EVAL);
+    evaluationVisitor.newScope();
     this.blocks[sig.get(methodName)].addLast(block);
   }
 
   public void unNestEvalBlock() {
     String methodName = getCurrentMapping().getMethodName(BlockType.EVAL);
+    evaluationVisitor.leaveScope();
     this.blocks[sig.get(methodName)].removeLast();
   }
 
@@ -226,6 +228,7 @@ public class ClassGenerator<T>{
   }
 
   public void rotateBlock() {
+    evaluationVisitor.previousExpressions.clear();
     for (LinkedList<JBlock> b : blocks) {
       b.add(new JBlock(true, true));
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EqualityVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EqualityVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EqualityVisitor.java
new file mode 100644
index 0000000..7945bb4
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EqualityVisitor.java
@@ -0,0 +1,324 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.expr;
+
+import com.google.common.collect.Lists;
+import org.apache.drill.common.expression.BooleanOperator;
+import org.apache.drill.common.expression.CastExpression;
+import org.apache.drill.common.expression.ConvertExpression;
+import org.apache.drill.common.expression.FunctionCall;
+import org.apache.drill.common.expression.FunctionHolderExpression;
+import org.apache.drill.common.expression.IfExpression;
+import org.apache.drill.common.expression.LogicalExpression;
+import org.apache.drill.common.expression.NullExpression;
+import org.apache.drill.common.expression.SchemaPath;
+import org.apache.drill.common.expression.TypedNullConstant;
+import org.apache.drill.common.expression.ValueExpressions.BooleanExpression;
+import org.apache.drill.common.expression.ValueExpressions.DateExpression;
+import org.apache.drill.common.expression.ValueExpressions.Decimal18Expression;
+import org.apache.drill.common.expression.ValueExpressions.Decimal28Expression;
+import org.apache.drill.common.expression.ValueExpressions.Decimal38Expression;
+import org.apache.drill.common.expression.ValueExpressions.Decimal9Expression;
+import org.apache.drill.common.expression.ValueExpressions.DoubleExpression;
+import org.apache.drill.common.expression.ValueExpressions.FloatExpression;
+import org.apache.drill.common.expression.ValueExpressions.IntExpression;
+import org.apache.drill.common.expression.ValueExpressions.IntervalDayExpression;
+import org.apache.drill.common.expression.ValueExpressions.IntervalYearExpression;
+import org.apache.drill.common.expression.ValueExpressions.LongExpression;
+import org.apache.drill.common.expression.ValueExpressions.QuotedString;
+import org.apache.drill.common.expression.ValueExpressions.TimeExpression;
+import org.apache.drill.common.expression.ValueExpressions.TimeStampExpression;
+import org.apache.drill.common.expression.visitors.AbstractExprVisitor;
+import org.apache.drill.exec.compile.sig.GeneratorMapping;
+
+import java.util.List;
+
+class EqualityVisitor extends AbstractExprVisitor<Boolean,LogicalExpression,RuntimeException> {
+
+  @Override
+  public Boolean visitFunctionCall(FunctionCall call, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof FunctionCall)) {
+      return false;
+    }
+    if (!checkType(call, value)) {
+      return false;
+    }
+    if (!call.getName().equals(((FunctionCall) value).getName())) {
+      return false;
+    }
+    return checkChildren(call, value);
+  }
+
+  @Override
+  public Boolean visitFunctionHolderExpression(FunctionHolderExpression holder, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof FunctionHolderExpression)) {
+      return false;
+    }
+    if (!checkType(holder, value)) {
+      return false;
+    }
+    if (!holder.getName().equals(((FunctionHolderExpression) value).getName())) {
+      return false;
+    }
+    return checkChildren(holder, value);
+  }
+
+  @Override
+  public Boolean visitIfExpression(IfExpression ifExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof IfExpression)) {
+      return false;
+    }
+    return checkChildren(ifExpr, value);
+  }
+
+  @Override
+  public Boolean visitBooleanOperator(BooleanOperator call, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof BooleanOperator)) {
+      return false;
+    }
+    if (!call.getName().equals(((BooleanOperator) value).getName())) {
+      return false;
+    }
+    return checkChildren(call, value);
+  }
+
+  @Override
+  public Boolean visitSchemaPath(SchemaPath path, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof SchemaPath)) {
+      return false;
+    }
+    return path.equals(value);
+  }
+
+  @Override
+  public Boolean visitIntConstant(IntExpression intExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof IntExpression)) {
+      return false;
+    }
+    return intExpr.getInt() == ((IntExpression) value).getInt();
+  }
+
+  @Override
+  public Boolean visitFloatConstant(FloatExpression fExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof FloatExpression)) {
+      return false;
+    }
+    return fExpr.getFloat() == ((FloatExpression) value).getFloat();
+  }
+
+  @Override
+  public Boolean visitLongConstant(LongExpression intExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof LongExpression)) {
+      return false;
+    }
+    return intExpr.getLong() == ((LongExpression) value).getLong();
+  }
+
+  @Override
+  public Boolean visitDateConstant(DateExpression intExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof DateExpression)) {
+      return false;
+    }
+    return intExpr.getDate() == ((DateExpression) value).getDate();
+  }
+
+  @Override
+  public Boolean visitTimeConstant(TimeExpression intExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof TimeExpression)) {
+      return false;
+    }
+    return intExpr.getTime() == ((TimeExpression) value).getTime();
+  }
+
+  @Override
+  public Boolean visitTimeStampConstant(TimeStampExpression intExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof TimeStampExpression)) {
+      return false;
+    }
+    return intExpr.getTimeStamp() == ((TimeStampExpression) value).getTimeStamp();
+  }
+
+  @Override
+  public Boolean visitIntervalYearConstant(IntervalYearExpression intExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof IntervalYearExpression)) {
+      return false;
+    }
+    return intExpr.getIntervalYear() == ((IntervalYearExpression) value).getIntervalYear();
+  }
+
+  @Override
+  public Boolean visitIntervalDayConstant(IntervalDayExpression intExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof IntervalDayExpression)) {
+      return false;
+    }
+    return intExpr.getIntervalDay() == ((IntervalDayExpression) value).getIntervalDay();
+  }
+
+  @Override
+  public Boolean visitDecimal9Constant(Decimal9Expression decExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof Decimal9Expression)) {
+      return false;
+    }
+    if (decExpr.getIntFromDecimal() != ((Decimal9Expression) value).getIntFromDecimal()) {
+      return false;
+    }
+    if (decExpr.getScale() != ((Decimal9Expression) value).getScale()) {
+      return false;
+    }
+    if (decExpr.getPrecision() != ((Decimal9Expression) value).getPrecision()) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public Boolean visitDecimal18Constant(Decimal18Expression decExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof Decimal18Expression)) {
+      return false;
+    }
+    if (decExpr.getLongFromDecimal() != ((Decimal18Expression) value).getLongFromDecimal()) {
+      return false;
+    }
+    if (decExpr.getScale() != ((Decimal18Expression) value).getScale()) {
+      return false;
+    }
+    if (decExpr.getPrecision() != ((Decimal18Expression) value).getPrecision()) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public Boolean visitDecimal28Constant(Decimal28Expression decExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof Decimal28Expression)) {
+      return false;
+    }
+    if (decExpr.getBigDecimal() != ((Decimal28Expression) value).getBigDecimal()) {
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public Boolean visitDecimal38Constant(Decimal38Expression decExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof Decimal38Expression)) {
+      return false;
+    }
+    if (decExpr.getBigDecimal() != ((Decimal38Expression) value).getBigDecimal()) {
+      return false;
+    }
+    if (!decExpr.getMajorType().equals(((Decimal38Expression) value).getMajorType())) {
+      return false;
+    }
+    return false;
+  }
+
+  @Override
+  public Boolean visitDoubleConstant(DoubleExpression dExpr, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof DoubleExpression)) {
+      return false;
+    }
+    return dExpr.getDouble() == ((DoubleExpression) value).getDouble();
+  }
+
+  @Override
+  public Boolean visitBooleanConstant(BooleanExpression e, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof BooleanExpression)) {
+      return false;
+    }
+    return e.getBoolean() == ((BooleanExpression) value).getBoolean();
+  }
+
+  @Override
+  public Boolean visitQuotedStringConstant(QuotedString e, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof QuotedString)) {
+      return false;
+    }
+    return e.getString().equals(((QuotedString) value).getString());
+  }
+
+  @Override
+  public Boolean visitNullExpression(NullExpression e, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof NullExpression)) {
+      return false;
+    }
+    return e.getMajorType().equals(value.getMajorType());
+  }
+
+  @Override
+  public Boolean visitCastExpression(CastExpression e, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof CastExpression)) {
+      return false;
+    }
+    if (!e.getMajorType().equals(value.getMajorType())) {
+      return false;
+    }
+    return checkChildren(e, value);
+  }
+
+  @Override
+  public Boolean visitConvertExpression(ConvertExpression e, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof ConvertExpression)) {
+      return false;
+    }
+    if (!e.getConvertFunction().equals(((ConvertExpression) value).getConvertFunction())) {
+      return false;
+    }
+    return checkChildren(e, value);
+  }
+
+  @Override
+  public Boolean visitNullConstant(TypedNullConstant e, LogicalExpression value) throws RuntimeException {
+    if (!(value instanceof TypedNullConstant)) {
+      return false;
+    }
+    return e.getMajorType().equals(e.getMajorType());
+  }
+
+  @Override
+  public Boolean visitUnknown(LogicalExpression e, LogicalExpression value) throws RuntimeException {
+    if (e instanceof ValueVectorReadExpression && value instanceof ValueVectorReadExpression) {
+      return visitValueVectorReadExpression((ValueVectorReadExpression) e, (ValueVectorReadExpression) value);
+    }
+    return false;
+  }
+
+  private Boolean visitValueVectorReadExpression(ValueVectorReadExpression e, ValueVectorReadExpression value) {
+    return e.getTypedFieldId().equals(value.getTypedFieldId());
+  }
+
+
+  private boolean checkChildren(LogicalExpression thisExpr, LogicalExpression thatExpr) {
+    List<LogicalExpression> theseChildren = Lists.newArrayList(thisExpr);
+    List<LogicalExpression> thoseChildren = Lists.newArrayList(thatExpr);
+
+    if (theseChildren.size() != thoseChildren.size()) {
+      return false;
+    }
+    for (int i = 0; i < theseChildren.size(); i++) {
+      if (!theseChildren.get(i).accept(this, thoseChildren.get(i))) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  private boolean checkType(LogicalExpression e1, LogicalExpression e2) {
+    return e1.getMajorType().equals(e2.getMajorType());
+  }
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
index 0c65835..3d38ac9 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
@@ -18,14 +18,17 @@
 package org.apache.drill.exec.expr;
 
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import java.util.Stack;
 
 import com.google.common.collect.Maps;
-import com.sun.codemodel.JOp;
 import org.apache.drill.common.expression.BooleanOperator;
 import org.apache.drill.common.expression.CastExpression;
 import org.apache.drill.common.expression.ConvertExpression;
+import org.apache.drill.common.expression.ExpressionStringBuilder;
 import org.apache.drill.common.expression.FunctionCall;
 import org.apache.drill.common.expression.FunctionHolderExpression;
 import org.apache.drill.common.expression.IfExpression;
@@ -51,10 +54,13 @@ import org.apache.drill.common.expression.ValueExpressions.QuotedString;
 import org.apache.drill.common.expression.ValueExpressions.TimeExpression;
 import org.apache.drill.common.expression.ValueExpressions.TimeStampExpression;
 import org.apache.drill.common.expression.visitors.AbstractExprVisitor;
+import org.apache.drill.common.expression.visitors.ExprVisitor;
 import org.apache.drill.common.types.TypeProtos.MajorType;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.common.types.Types;
 import org.apache.drill.exec.compile.sig.ConstantExpressionIdentifier;
+import org.apache.drill.exec.compile.sig.GeneratorMapping;
+import org.apache.drill.exec.compile.sig.MappingSet;
 import org.apache.drill.exec.expr.ClassGenerator.BlockType;
 import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer;
 import org.apache.drill.exec.expr.fn.AbstractFuncHolder;
@@ -78,6 +84,8 @@ import com.sun.codemodel.JVar;
  * Visitor that generates code for eval
  */
 public class EvaluationVisitor {
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(EvaluationVisitor.class);
+
 
   private final FunctionImplementationRegistry registry;
 
@@ -94,7 +102,59 @@ public class EvaluationVisitor {
     } else {
       constantBoundaries = ConstantExpressionIdentifier.getConstantExpressionSet(e);
     }
-    return e.accept(new ConstantFilter(constantBoundaries), generator);
+    return e.accept(new CSEFilter(constantBoundaries), generator);
+  }
+
+  private class ExpressionHolder {
+    private LogicalExpression expression;
+    private GeneratorMapping mapping;
+    private MappingSet mappingSet;
+
+    ExpressionHolder(LogicalExpression expression, MappingSet mappingSet) {
+      this.expression = expression;
+      this.mapping = mappingSet.getCurrentMapping();
+      this.mappingSet = mappingSet;
+    }
+
+    @Override
+    public int hashCode() {
+      return expression.accept(new HashVisitor(), null);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+      if (!(obj instanceof ExpressionHolder)) {
+        return false;
+      }
+      ExpressionHolder that = (ExpressionHolder) obj;
+      return this.mappingSet == that.mappingSet && this.mapping == that.mapping && expression.accept(new EqualityVisitor(), that.expression);
+    }
+  }
+
+  Map<ExpressionHolder,HoldingContainer> previousExpressions = Maps.newHashMap();
+
+  Stack<Map<ExpressionHolder,HoldingContainer>> mapStack = new Stack();
+
+  void newScope() {
+    mapStack.push(previousExpressions);
+    previousExpressions = new HashMap(previousExpressions);
+  }
+
+  void leaveScope() {
+    previousExpressions.clear();
+    previousExpressions = mapStack.pop();
+  }
+
+  private HoldingContainer getPrevious(LogicalExpression expression, MappingSet mappingSet) {
+    HoldingContainer previous = previousExpressions.get(new ExpressionHolder(expression, mappingSet));
+    if (previous != null) {
+      logger.debug("Found previously evaluated expression: {}", ExpressionStringBuilder.toString(expression));
+    }
+    return previous;
+  }
+
+  private void put(LogicalExpression expression, HoldingContainer hc, MappingSet mappingSet) {
+    previousExpressions.put(new ExpressionHolder(expression, mappingSet), hc);
   }
 
   private class EvalVisitor extends AbstractExprVisitor<HoldingContainer, ClassGenerator<?>, RuntimeException> {
@@ -733,6 +793,261 @@ public class EvaluationVisitor {
 
   }
 
+  private class CSEFilter extends ConstantFilter {
+
+    public CSEFilter(Set<LogicalExpression> constantBoundaries) {
+      super(constantBoundaries);
+    }
+
+    @Override
+    public HoldingContainer visitFunctionCall(FunctionCall call, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(call, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitFunctionCall(call, generator);
+        put(call, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitFunctionHolderExpression(FunctionHolderExpression holder, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(holder, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitFunctionHolderExpression(holder, generator);
+        put(holder, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitIfExpression(IfExpression ifExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(ifExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitIfExpression(ifExpr, generator);
+        put(ifExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitBooleanOperator(BooleanOperator call, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(call, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitBooleanOperator(call, generator);
+        put(call, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitSchemaPath(SchemaPath path, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(path, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitSchemaPath(path, generator);
+        put(path, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitIntConstant(IntExpression intExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(intExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitIntConstant(intExpr, generator);
+        put(intExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitFloatConstant(FloatExpression fExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(fExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitFloatConstant(fExpr, generator);
+        put(fExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitLongConstant(LongExpression longExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(longExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitLongConstant(longExpr, generator);
+        put(longExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitDateConstant(DateExpression dateExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(dateExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitDateConstant(dateExpr, generator);
+        put(dateExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitTimeConstant(TimeExpression timeExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(timeExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitTimeConstant(timeExpr, generator);
+        put(timeExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitTimeStampConstant(TimeStampExpression timeStampExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(timeStampExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitTimeStampConstant(timeStampExpr, generator);
+        put(timeStampExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitIntervalYearConstant(IntervalYearExpression intervalYearExpression, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(intervalYearExpression, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitIntervalYearConstant(intervalYearExpression, generator);
+        put(intervalYearExpression, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitIntervalDayConstant(IntervalDayExpression intervalDayExpression, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(intervalDayExpression, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitIntervalDayConstant(intervalDayExpression, generator);
+        put(intervalDayExpression, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitDecimal9Constant(Decimal9Expression decExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(decExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitDecimal9Constant(decExpr, generator);
+        put(decExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitDecimal18Constant(Decimal18Expression decExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(decExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitDecimal18Constant(decExpr, generator);
+        put(decExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitDecimal28Constant(Decimal28Expression decExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(decExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitDecimal28Constant(decExpr, generator);
+        put(decExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitDecimal38Constant(Decimal38Expression decExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(decExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitDecimal38Constant(decExpr, generator);
+        put(decExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitDoubleConstant(DoubleExpression dExpr, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(dExpr, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitDoubleConstant(dExpr, generator);
+        put(dExpr, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitBooleanConstant(BooleanExpression e, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(e, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitBooleanConstant(e, generator);
+        put(e, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitQuotedStringConstant(QuotedString e, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(e, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitQuotedStringConstant(e, generator);
+        put(e, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitNullConstant(TypedNullConstant e, ClassGenerator<?> generator) throws RuntimeException {
+      return super.visitNullConstant(e, generator);
+    }
+
+    @Override
+    public HoldingContainer visitNullExpression(NullExpression e, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(e, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitNullExpression(e, generator);
+        put(e, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitUnknown(LogicalExpression e, ClassGenerator<?> generator) throws RuntimeException {
+      if (e instanceof ValueVectorReadExpression) {
+        HoldingContainer hc = getPrevious(e, generator.getMappingSet());
+        if (hc == null) {
+          hc = super.visitUnknown(e, generator);
+          put(e, hc, generator.getMappingSet());
+        }
+        return hc;
+      }
+      return super.visitUnknown(e, generator);
+    }
+
+    @Override
+    public HoldingContainer visitCastExpression(CastExpression e, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(e, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitCastExpression(e, generator);
+        put(e, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+
+    @Override
+    public HoldingContainer visitConvertExpression(ConvertExpression e, ClassGenerator<?> generator) throws RuntimeException {
+      HoldingContainer hc = getPrevious(e, generator.getMappingSet());
+      if (hc == null) {
+        hc = super.visitConvertExpression(e, generator);
+        put(e, hc, generator.getMappingSet());
+      }
+      return hc;
+    }
+  }
+
   private class ConstantFilter extends EvalVisitor {
 
     private Set<LogicalExpression> constantBoundaries;

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HashVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HashVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HashVisitor.java
new file mode 100644
index 0000000..27c349e
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/HashVisitor.java
@@ -0,0 +1,186 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.expr;
+
+import com.google.common.collect.Lists;
+import org.apache.drill.common.expression.BooleanOperator;
+import org.apache.drill.common.expression.CastExpression;
+import org.apache.drill.common.expression.ConvertExpression;
+import org.apache.drill.common.expression.FunctionCall;
+import org.apache.drill.common.expression.FunctionHolderExpression;
+import org.apache.drill.common.expression.IfExpression;
+import org.apache.drill.common.expression.IfExpression.IfCondition;
+import org.apache.drill.common.expression.LogicalExpression;
+import org.apache.drill.common.expression.NullExpression;
+import org.apache.drill.common.expression.SchemaPath;
+import org.apache.drill.common.expression.TypedNullConstant;
+import org.apache.drill.common.expression.ValueExpressions.BooleanExpression;
+import org.apache.drill.common.expression.ValueExpressions.DateExpression;
+import org.apache.drill.common.expression.ValueExpressions.Decimal18Expression;
+import org.apache.drill.common.expression.ValueExpressions.Decimal28Expression;
+import org.apache.drill.common.expression.ValueExpressions.Decimal38Expression;
+import org.apache.drill.common.expression.ValueExpressions.Decimal9Expression;
+import org.apache.drill.common.expression.ValueExpressions.DoubleExpression;
+import org.apache.drill.common.expression.ValueExpressions.FloatExpression;
+import org.apache.drill.common.expression.ValueExpressions.IntExpression;
+import org.apache.drill.common.expression.ValueExpressions.IntervalDayExpression;
+import org.apache.drill.common.expression.ValueExpressions.IntervalYearExpression;
+import org.apache.drill.common.expression.ValueExpressions.LongExpression;
+import org.apache.drill.common.expression.ValueExpressions.QuotedString;
+import org.apache.drill.common.expression.ValueExpressions.TimeExpression;
+import org.apache.drill.common.expression.ValueExpressions.TimeStampExpression;
+import org.apache.drill.common.expression.visitors.AbstractExprVisitor;
+import org.apache.drill.exec.expr.fn.DrillFuncHolder;
+
+import java.util.List;
+
+public class HashVisitor extends AbstractExprVisitor<Integer,Void,RuntimeException> {
+  @Override
+  public Integer visitFunctionCall(FunctionCall call, Void value) throws RuntimeException {
+    return compute(call, 1);
+  }
+
+  @Override
+  public Integer visitFunctionHolderExpression(FunctionHolderExpression holder, Void value) throws RuntimeException {
+    return compute(holder, 2);
+  }
+
+  @Override
+  public Integer visitIfExpression(IfExpression ifExpr, Void value) throws RuntimeException {
+    return compute(ifExpr, 3);
+  }
+
+  @Override
+  public Integer visitBooleanOperator(BooleanOperator op, Void value) throws RuntimeException {
+    return compute(op, 4);
+  }
+
+  @Override
+  public Integer visitSchemaPath(SchemaPath path, Void value) throws RuntimeException {
+    return compute(path, 5);
+  }
+
+  @Override
+  public Integer visitFloatConstant(FloatExpression fExpr, Void value) throws RuntimeException {
+    return compute(fExpr, 6);
+  }
+
+  @Override
+  public Integer visitIntConstant(IntExpression intExpr, Void value) throws RuntimeException {
+    return compute(intExpr, 7);
+  }
+
+  @Override
+  public Integer visitLongConstant(LongExpression intExpr, Void value) throws RuntimeException {
+    return compute(intExpr, 8);
+  }
+
+
+  @Override
+  public Integer visitDecimal9Constant(Decimal9Expression decExpr, Void value) throws RuntimeException {
+    return compute(decExpr, 9);
+  }
+
+  @Override
+  public Integer visitDecimal18Constant(Decimal18Expression decExpr, Void value) throws RuntimeException {
+    return compute(decExpr, 10);
+  }
+
+  @Override
+  public Integer visitDecimal28Constant(Decimal28Expression decExpr, Void value) throws RuntimeException {
+    return compute(decExpr, 11);
+  }
+
+  @Override
+  public Integer visitDecimal38Constant(Decimal38Expression decExpr, Void value) throws RuntimeException {
+    return compute(decExpr, 12);
+  }
+
+  @Override
+  public Integer visitDateConstant(DateExpression intExpr, Void value) throws RuntimeException {
+    return compute(intExpr, 13);
+  }
+
+  @Override
+  public Integer visitTimeConstant(TimeExpression intExpr, Void value) throws RuntimeException {
+    return compute(intExpr, 14);
+  }
+
+  @Override
+  public Integer visitTimeStampConstant(TimeStampExpression intExpr, Void value) throws RuntimeException {
+    return compute(intExpr, 15);
+  }
+
+  @Override
+  public Integer visitIntervalYearConstant(IntervalYearExpression intExpr, Void value) throws RuntimeException {
+    return compute(intExpr, 16);
+  }
+
+  @Override
+  public Integer visitIntervalDayConstant(IntervalDayExpression intExpr, Void value) throws RuntimeException {
+    return compute(intExpr, 17);
+  }
+
+  @Override
+  public Integer visitDoubleConstant(DoubleExpression dExpr, Void value) throws RuntimeException {
+    return compute(dExpr, 18);
+  }
+
+  @Override
+  public Integer visitBooleanConstant(BooleanExpression e, Void value) throws RuntimeException {
+    return compute(e, 19);
+  }
+
+  @Override
+  public Integer visitQuotedStringConstant(QuotedString e, Void value) throws RuntimeException {
+    return compute(e, 20);
+  }
+
+  @Override
+  public Integer visitCastExpression(CastExpression e, Void value) throws RuntimeException {
+    return compute(e, 21);
+  }
+
+  @Override
+  public Integer visitConvertExpression(ConvertExpression e, Void value) throws RuntimeException {
+    return compute(e, 22);
+  }
+
+  @Override
+  public Integer visitNullConstant(TypedNullConstant e, Void value) throws RuntimeException {
+    return compute(e, 23);
+  }
+
+  @Override
+  public Integer visitNullExpression(NullExpression e, Void value) throws RuntimeException {
+    return compute(e, 24);
+  }
+
+  @Override
+  public Integer visitUnknown(LogicalExpression e, Void value) throws RuntimeException {
+    return compute(e, 25);
+  }
+
+  private int compute(LogicalExpression e, int seed) {
+    int hash = seed;
+    for (LogicalExpression child : e) {
+      hash = hash * 31 + child.accept(this, null);
+    }
+    return hash;
+  }
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java
index a5abf3e..a556dc2 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ValueVectorReadExpression.java
@@ -87,4 +87,9 @@ public class ValueVectorReadExpression implements LogicalExpression{
     return 0; // TODO
   }
 
+  @Override
+  public String toString() {
+    return "ValueVectorReadExpression [fieldId=" + fieldId + "]";
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
index 8a7d705..ffcb491 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggBatch.java
@@ -256,7 +256,7 @@ public class HashAggBatch extends AbstractRecordBatch<HashAggregate> {
     cg.setMappingSet(UpdateAggrValuesMapping);
 
     for (LogicalExpression aggr : aggrExprs) {
-      HoldingContainer hc = cg.addExpr(aggr);
+      HoldingContainer hc = cg.addExpr(aggr, true);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java
index 98cf81d..08ccaa1 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/ChainedHashTable.java
@@ -293,7 +293,7 @@ public class ChainedHashTable {
         ValueVectorReadExpression vvrExpr = new ValueVectorReadExpression(htKeyFieldIds[i]);
         boolean useSetSafe = !Types.isFixedWidthType(vvrExpr.getMajorType()) || Types.isRepeated(vvrExpr.getMajorType());
         ValueVectorWriteExpression vvwExpr = new ValueVectorWriteExpression(outKeyFieldIds[i], vvrExpr, useSetSafe);
-        cg.addExpr(vvwExpr);
+        cg.addExpr(vvwExpr, true);
       }
 
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java
index 0a96285..17ac7b1 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterRecordBatch.java
@@ -149,7 +149,7 @@ public class FilterRecordBatch extends AbstractSingleRecordBatch<Filter>{
       throw new SchemaChangeException(String.format("Failure while trying to materialize incoming schema.  Errors:\n %s.", collector.toErrorString()));
     }
 
-    cg.addExpr(new ReturnValueExpression(expr));
+    cg.addExpr(new ReturnValueExpression(expr), false);
 
     for (final VectorWrapper<?> vw : incoming) {
       for (final ValueVector vv : vw.getValueVectors()) {
@@ -184,7 +184,7 @@ public class FilterRecordBatch extends AbstractSingleRecordBatch<Filter>{
       throw new SchemaChangeException(String.format("Failure while trying to materialize incoming schema.  Errors:\n %s.", collector.toErrorString()));
     }
 
-    cg.addExpr(new ReturnValueExpression(expr));
+    cg.addExpr(new ReturnValueExpression(expr), false);
 
     for (final VectorWrapper<?> v : incoming) {
       final TransferPair pair = v.getValueVector().makeTransferPair(container.addOrGet(v.getField(), callBack));

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
index 2bffded..ab01db4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
@@ -46,6 +46,7 @@ import org.apache.drill.exec.expr.ClassGenerator.HoldingContainer;
 import org.apache.drill.exec.expr.CodeGenerator;
 import org.apache.drill.exec.expr.DrillFuncHolderExpr;
 import org.apache.drill.exec.expr.ExpressionTreeMaterializer;
+import org.apache.drill.exec.expr.HashVisitor;
 import org.apache.drill.exec.expr.TypeHelper;
 import org.apache.drill.exec.expr.ValueVectorReadExpression;
 import org.apache.drill.exec.expr.ValueVectorWriteExpression;
@@ -353,7 +354,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project> {
               allocationVectors.add(vv);
               final TypedFieldId fid = container.getValueVectorId(outputField.getPath());
               final ValueVectorWriteExpression write = new ValueVectorWriteExpression(fid, expr, true);
-              final HoldingContainer hc = cg.addExpr(write);
+              final HoldingContainer hc = cg.addExpr(write, false);
             }
           }
           continue;
@@ -417,7 +418,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project> {
 
         // The reference name will be passed to ComplexWriter, used as the name of the output vector from the writer.
         ((DrillComplexWriterFuncHolder) ((DrillFuncHolderExpr) expr).getHolder()).setReference(namedExpression.getRef());
-        cg.addExpr(expr);
+        cg.addExpr(expr, false);
       } else {
         // need to do evaluation.
         final ValueVector vector = container.addOrGet(outputField, callBack);
@@ -425,7 +426,7 @@ public class ProjectRecordBatch extends AbstractSingleRecordBatch<Project> {
         final TypedFieldId fid = container.getValueVectorId(outputField.getPath());
         final boolean useSetSafe = !(vector instanceof FixedWidthVector);
         final ValueVectorWriteExpression write = new ValueVectorWriteExpression(fid, expr, useSetSafe);
-        final HoldingContainer hc = cg.addExpr(write);
+        final HoldingContainer hc = cg.addExpr(write, false);
 
         // We cannot do multiple transfers from the same vector. However we still need to instantiate the output vector.
         if (expr instanceof ValueVectorReadExpression) {

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
index 55440f7..4b155ee 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
@@ -26,8 +26,7 @@ import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.util.FileUtils;
 import org.apache.drill.common.util.TestTools;
 import org.apache.drill.exec.ExecConstants;
-import org.apache.drill.exec.planner.physical.PlannerSettings;
-import org.junit.After;
+import org.apache.drill.exec.compile.ClassTransformer;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -424,7 +423,9 @@ public class TestExampleQueries extends BaseTestQuery {
   public void testJoinCondWithDifferentTypes() throws Exception {
     test("select t1.department_description from cp.`department.json` t1, cp.`employee.json` t2 where (cast(t1.department_id as double)) = t2.department_id");
     test("select t1.full_name from cp.`employee.json` t1, cp.`department.json` t2 where cast(t1.department_id as double) = t2.department_id and cast(t1.position_id as bigint) = t2.department_id");
-    test("select t1.full_name from cp.`employee.json` t1, cp.`department.json` t2 where t1.department_id = t2.department_id and t1.position_id = t2.department_id");
+
+    // See DRILL-3995. Re-enable this once fixed.
+//    test("select t1.full_name from cp.`employee.json` t1, cp.`department.json` t2 where t1.department_id = t2.department_id and t1.position_id = t2.department_id");
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/drill/blob/b33326ba/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java b/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
index e81c661..641cf9d 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
@@ -251,6 +251,7 @@ public class TestFunctionsQuery extends BaseTestQuery {
         .go();
   }
 
+  @Ignore("DRILL-3909")
   @Test
   public void testRoundWithScaleDecimalFunction() throws Exception {
     String query = "SELECT " +


Mime
View raw message