drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [13/14] git commit: DRILL-783: Convert function support in HBase filter push down.
Date Tue, 20 May 2014 03:02:01 GMT
DRILL-783: Convert function support in HBase filter push down.

+ Enable HBase test suit (failures fixed by DRILL-761).


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

Branch: refs/heads/master
Commit: e9e63c4a7f3ac354dc346799f19bdccc56d8bd0e
Parents: 6d4dc8f
Author: Aditya Kishore <aditya@maprtech.com>
Authored: Fri May 16 17:48:55 2014 -0700
Committer: Jacques Nadeau <jacques@apache.org>
Committed: Mon May 19 18:06:32 2014 -0700

----------------------------------------------------------------------
 .../common/expression/ConvertExpression.java    |  23 +-
 .../expression/ExpressionStringBuilder.java     |   2 +-
 .../store/hbase/CompareFunctionsProcessor.java  | 232 +++++++++++++++++++
 .../exec/store/hbase/HBaseFilterBuilder.java    |  74 ++----
 .../org/apache/drill/hbase/HBaseTestsSuite.java |   1 -
 .../drill/hbase/TestHBaseFilterPushDown.java    |   9 +-
 .../drill/exec/expr/EvaluationVisitor.java      |   2 +-
 .../exec/expr/ExpressionTreeMaterializer.java   |   2 +-
 8 files changed, 278 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e9e63c4a/common/src/main/java/org/apache/drill/common/expression/ConvertExpression.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/expression/ConvertExpression.java
b/common/src/main/java/org/apache/drill/common/expression/ConvertExpression.java
index c028083..9debd15 100644
--- a/common/src/main/java/org/apache/drill/common/expression/ConvertExpression.java
+++ b/common/src/main/java/org/apache/drill/common/expression/ConvertExpression.java
@@ -28,23 +28,26 @@ public class ConvertExpression extends LogicalExpressionBase implements
Iterable
 
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ConvertExpression.class);
 
+  public static final String CONVERT_FROM = "convert_from";
+  public static final String CONVERT_TO = "convert_to";
+  
   private final LogicalExpression input;
   private final MajorType type;
   private final String convertFunction;
-  private final String conversionType;
+  private final String encodingType;
 
   /**
-   * @param conversionType
+   * @param encodingType
    * @param convertFunction
    * @param input
    * @param pos
    */
-  public ConvertExpression(String convertFunction, String conversionType, LogicalExpression
input, ExpressionPosition pos) {
+  public ConvertExpression(String convertFunction, String encodingType, LogicalExpression
input, ExpressionPosition pos) {
     super(pos);
     this.input = input;
-    this.convertFunction = convertFunction.toLowerCase();
-    this.conversionType = conversionType.toUpperCase();
-    this.type = Types.getMajorTypeFromName(conversionType.split("_", 2)[0].toLowerCase());
+    this.convertFunction = CONVERT_FROM.equals(convertFunction.toLowerCase()) ? CONVERT_FROM
: CONVERT_TO;
+    this.encodingType = encodingType.toUpperCase();
+    this.type = Types.getMajorTypeFromName(encodingType.split("_", 2)[0].toLowerCase());
   }
 
   @Override
@@ -70,13 +73,13 @@ public class ConvertExpression extends LogicalExpressionBase implements
Iterable
     return type;
   }
 
-  public String getConversionType() {
-    return conversionType;
+  public String getEncodingType() {
+    return encodingType;
   }
 
   @Override
   public String toString() {
-    return "ConvertExpression [input=" + input + ", type=" + type + ", convertFunction="
-        + convertFunction + ", conversionType=" + conversionType + "]";
+    return "ConvertExpression [input=" + input + ", type=" + Types.toString(type) + ", convertFunction="
+        + convertFunction + ", conversionType=" + encodingType + "]";
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e9e63c4a/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 9588863..9301528 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
@@ -226,7 +226,7 @@ public class ExpressionStringBuilder extends AbstractExprVisitor<Void,
StringBui
   public Void visitConvertExpression(ConvertExpression e, StringBuilder sb) throws RuntimeException
{
     sb.append(e.getConvertFunction()).append("(");
     e.getInput().accept(this, sb);
-    sb.append(", \"").append(e.getConversionType()).append("\")");
+    sb.append(", \"").append(e.getEncodingType()).append("\")");
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e9e63c4a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/CompareFunctionsProcessor.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/CompareFunctionsProcessor.java
b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/CompareFunctionsProcessor.java
new file mode 100644
index 0000000..6810f81
--- /dev/null
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/CompareFunctionsProcessor.java
@@ -0,0 +1,232 @@
+/**
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.store.hbase;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+
+import java.nio.ByteOrder;
+
+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.LogicalExpression;
+import org.apache.drill.common.expression.SchemaPath;
+import org.apache.drill.common.expression.ValueExpressions.BooleanExpression;
+import org.apache.drill.common.expression.ValueExpressions.DateExpression;
+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.LongExpression;
+import org.apache.drill.common.expression.ValueExpressions.QuotedString;
+import org.apache.drill.common.expression.ValueExpressions.TimeExpression;
+import org.apache.drill.common.expression.visitors.AbstractExprVisitor;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+class CompareFunctionsProcessor extends AbstractExprVisitor<Boolean, LogicalExpression,
RuntimeException> {
+  private byte[] value;
+  private boolean success;
+  private boolean isEqualityFn;
+  private SchemaPath path;
+  private String functionName;
+
+  public static boolean isCompareFunction(String functionName) {
+    return COMPARE_FUNCTIONS_TRANSPOSE_MAP.keySet().contains(functionName);
+  }
+
+  public static CompareFunctionsProcessor process(FunctionCall call, boolean nullComparatorSupported)
{
+    String functionName = call.getName();
+    LogicalExpression nameArg = call.args.get(0);
+    LogicalExpression valueArg = call.args.size() == 2 ? call.args.get(1) : null;
+    CompareFunctionsProcessor evaluator = new CompareFunctionsProcessor(functionName);
+
+    if (valueArg != null) { // binary function
+      if (VALUE_EXPRESSION_CLASSES.contains(nameArg.getClass())) {
+        LogicalExpression swapArg = valueArg;
+        valueArg = nameArg;
+        nameArg = swapArg;
+        evaluator.functionName = COMPARE_FUNCTIONS_TRANSPOSE_MAP.get(functionName);
+      }
+      evaluator.success = nameArg.accept(evaluator, valueArg);
+    } else if (nullComparatorSupported && call.args.get(0) instanceof SchemaPath)
{
+      evaluator.success = true;
+      evaluator.path = (SchemaPath) nameArg;
+    }
+
+    return evaluator;
+  }
+
+  public CompareFunctionsProcessor(String functionName) {
+    this.success = false;
+    this.functionName = functionName;
+    this.isEqualityFn = COMPARE_FUNCTIONS_TRANSPOSE_MAP.containsKey(functionName)
+        && COMPARE_FUNCTIONS_TRANSPOSE_MAP.get(functionName).equals(functionName);
+  }
+
+  public byte[] getValue() {
+    return value;
+  }
+
+  public boolean isSuccess() {
+    return success;
+  }
+
+  public SchemaPath getPath() {
+    return path;
+  }
+
+  public String getFunctionName() {
+    return functionName;
+  }
+
+  @Override
+  public Boolean visitCastExpression(CastExpression e, LogicalExpression valueArg) throws
RuntimeException {
+    if (e.getInput() instanceof CastExpression || e.getInput() instanceof SchemaPath) {
+      return e.getInput().accept(this, valueArg);
+    }
+    return false;
+  }
+
+  @Override
+  public Boolean visitConvertExpression(ConvertExpression e, LogicalExpression valueArg)
throws RuntimeException {
+    if (e.getConvertFunction() == ConvertExpression.CONVERT_FROM && e.getInput()
instanceof SchemaPath) {
+      ByteBuf bb = null;
+      String encodingType = e.getEncodingType();
+      switch (encodingType) {
+      case "INT_BE":
+      case "INT":
+      case "UINT_BE":
+      case "UINT":
+      case "UINT4_BE":
+      case "UINT4":
+        if (valueArg instanceof IntExpression
+            && (isEqualityFn || encodingType.startsWith("U"))) {
+          bb = Unpooled.wrappedBuffer(new byte[4]).order(encodingType.endsWith("_BE") ? ByteOrder.BIG_ENDIAN
: ByteOrder.LITTLE_ENDIAN);
+          bb.writeInt(((IntExpression)valueArg).getInt());
+        }
+        break;
+      case "BIGINT_BE":
+      case "BIGINT":
+      case "UINT8_BE":
+      case "UINT8":
+        if (valueArg instanceof LongExpression
+            && (isEqualityFn || encodingType.startsWith("U"))) {
+          bb = Unpooled.wrappedBuffer(new byte[8]).order(encodingType.endsWith("_BE") ? ByteOrder.BIG_ENDIAN
: ByteOrder.LITTLE_ENDIAN);
+          bb.writeLong(((LongExpression)valueArg).getLong());
+        }
+        break;
+      case "FLOAT":
+        if (valueArg instanceof FloatExpression && isEqualityFn) {
+          bb = Unpooled.wrappedBuffer(new byte[4]).order(ByteOrder.BIG_ENDIAN);
+          bb.writeFloat(((FloatExpression)valueArg).getFloat());
+        }
+        break;
+      case "DOUBLE":
+        if (valueArg instanceof DoubleExpression && isEqualityFn) {
+          bb = Unpooled.wrappedBuffer(new byte[8]).order(ByteOrder.BIG_ENDIAN);;
+          bb.writeDouble(((DoubleExpression)valueArg).getDouble());
+        }
+        break;
+      case "TIME_EPOCH":
+      case "TIME_EPOCH_BE":
+        if (valueArg instanceof TimeExpression) {
+          bb = Unpooled.wrappedBuffer(new byte[8]).order(encodingType.endsWith("_BE") ? ByteOrder.BIG_ENDIAN
: ByteOrder.LITTLE_ENDIAN);
+          bb.writeLong(((TimeExpression)valueArg).getTime());
+        }
+        break;
+      case "DATE_EPOCH":
+      case "DATE_EPOCH_BE":
+        if (valueArg instanceof DateExpression) {
+          bb = Unpooled.wrappedBuffer(new byte[8]).order(encodingType.endsWith("_BE") ? ByteOrder.BIG_ENDIAN
: ByteOrder.LITTLE_ENDIAN);
+          bb.writeLong(((DateExpression)valueArg).getDate());
+        }
+        break;
+      case "BOOLEAN_BYTE":
+        if (valueArg instanceof BooleanExpression) {
+          bb = Unpooled.wrappedBuffer(new byte[1]);
+          bb.writeByte(((BooleanExpression)valueArg).getBoolean() ? 1 : 0);
+        }
+        break;
+      case "UTF8":
+        // let visitSchemaPath() handle this.
+        return e.getInput().accept(this, valueArg);
+      }
+
+      if (bb != null) {
+        this.value = bb.array();
+        this.path = (SchemaPath)e.getInput();
+        return true;
+      }
+    }
+    return false;
+  }
+
+  @Override
+  public Boolean visitUnknown(LogicalExpression e, LogicalExpression valueArg) throws RuntimeException
{
+    return false;
+  }
+
+  @Override
+  public Boolean visitSchemaPath(SchemaPath path, LogicalExpression valueArg) throws RuntimeException
{
+    if (valueArg instanceof QuotedString) {
+      this.value = ((QuotedString) valueArg).value.getBytes();
+      this.path = path;
+      return true;
+    }
+    return false;
+  }
+
+  private static final ImmutableSet<Class<? extends LogicalExpression>> VALUE_EXPRESSION_CLASSES;
+  static {
+    ImmutableSet.Builder<Class<? extends LogicalExpression>> builder = ImmutableSet.builder();
+    VALUE_EXPRESSION_CLASSES = builder
+        .add(BooleanExpression.class)
+        .add(DateExpression.class)
+        .add(DoubleExpression.class)
+        .add(FloatExpression.class)
+        .add(IntExpression.class)
+        .add(LongExpression.class)
+        .add(QuotedString.class)
+        .add(TimeExpression.class)
+        .build();
+  }
+
+  private static final ImmutableMap<String, String> COMPARE_FUNCTIONS_TRANSPOSE_MAP;
+  static {
+    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
+    COMPARE_FUNCTIONS_TRANSPOSE_MAP = builder
+        // unary functions
+        .put("isnotnull", "isnotnull")
+        .put("isNotNull", "isNotNull")
+        .put("is not null", "is not null")
+        .put("isnull", "isnull")
+        .put("isNull", "isNull")
+        .put("is null", "is null")
+        // binary functions
+        .put("equal", "equal")
+        .put("not_equal", "not_equal")
+        .put("greater_than_or_equal_to", "less_than_or_equal_to")
+        .put("greater_than", "less_than")
+        .put("less_than_or_equal_to", "greater_than_or_equal_to")
+        .put("less_than", "greater_than")
+        .build();
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e9e63c4a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java
b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java
index 924cd6e..ad26972 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseFilterBuilder.java
@@ -19,13 +19,10 @@ package org.apache.drill.exec.store.hbase;
 
 import java.util.Arrays;
 
-import org.apache.drill.common.expression.CastExpression;
 import org.apache.drill.common.expression.FunctionCall;
 import org.apache.drill.common.expression.LogicalExpression;
 import org.apache.drill.common.expression.SchemaPath;
-import org.apache.drill.common.expression.ValueExpressions.QuotedString;
 import org.apache.drill.common.expression.visitors.AbstractExprVisitor;
-import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.filter.BinaryComparator;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
@@ -36,8 +33,6 @@ import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
 import org.apache.hadoop.hbase.filter.WritableByteArrayComparable;
 
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
 
 public class HBaseFilterBuilder extends AbstractExprVisitor<HBaseScanSpec, Void, RuntimeException>
implements DrillHBaseConstants {
 
@@ -54,7 +49,17 @@ public class HBaseFilterBuilder extends AbstractExprVisitor<HBaseScanSpec,
Void,
 
   public HBaseScanSpec parseTree() {
     HBaseScanSpec parsedSpec = le.accept(this, null);
-    return parsedSpec != null ? mergeScanSpecs("booleanAnd", this.groupScan.getHBaseScanSpec(),
parsedSpec ) : null;
+    if (parsedSpec != null) {
+      parsedSpec = mergeScanSpecs("booleanAnd", this.groupScan.getHBaseScanSpec(), parsedSpec);
+      /*
+       * If RowFilter is THE filter attached to the scan specification,
+       * remove it since its effect is also achieved through startRow and stopRow.
+       */
+      if (parsedSpec.filter instanceof RowFilter) {
+        parsedSpec.filter = null;
+      }
+    }
+    return parsedSpec;
   }
 
   public boolean isAllExpressionsConverted() {
@@ -72,22 +77,18 @@ public class HBaseFilterBuilder extends AbstractExprVisitor<HBaseScanSpec,
Void,
     HBaseScanSpec nodeScanSpec = null;
     String functionName = call.getName();
     ImmutableList<LogicalExpression> args = call.args;
-    if (COMPARE_FUNCTIONS_TRANSPOSE_MAP.containsKey(functionName)) {
-      LogicalExpression nameArg = args.get(0);
-      LogicalExpression valueArg = args.get(1);
-      if (nameArg instanceof QuotedString) {
-        valueArg = nameArg;
-        nameArg = args.get(1);
-        functionName = COMPARE_FUNCTIONS_TRANSPOSE_MAP.get(functionName);
-      }
 
-      while (nameArg instanceof CastExpression
-          && nameArg.getMajorType().getMinorType() == MinorType.VARCHAR) {
-        nameArg = ((CastExpression) nameArg).getInput();
-      }
+    if (CompareFunctionsProcessor.isCompareFunction(functionName)) {
+      /*
+       * HBASE-10848: Bug in HBase versions (0.94.[0-18], 0.96.[0-2], 0.98.[0-1])
+       * causes a filter with NullComparator to fail. Enable only if specified in
+       * the configuration (after ensuring that the HBase cluster has the fix).
+       */
+      boolean nullComparatorSupported = groupScan.getHBaseConf().getBoolean("drill.hbase.supports.null.comparator",
false);
 
-      if (nameArg instanceof SchemaPath && valueArg instanceof QuotedString) {
-        nodeScanSpec = createHBaseScanSpec(functionName, (SchemaPath) nameArg, ((QuotedString)
valueArg).value.getBytes());
+      CompareFunctionsProcessor processor = CompareFunctionsProcessor.process(call, nullComparatorSupported);
+      if (processor.isSuccess()) {
+        nodeScanSpec = createHBaseScanSpec(processor.getFunctionName(), processor.getPath(),
processor.getValue());
       }
     } else {
       switch (functionName) {
@@ -104,28 +105,13 @@ public class HBaseFilterBuilder extends AbstractExprVisitor<HBaseScanSpec,
Void,
           }
         }
         break;
-      case "isnotnull":
-      case "isNotNull":
-      case "is not null":
-      case "isnull":
-      case "isNull":
-      case "is null":
-        /*
-         * HBASE-10848: Bug in HBase versions (0.94.[0-18], 0.96.[0-2], 0.98.[0-1])
-         * causes a filter with NullComparator to fail. Enable only if specified in
-         * the configuration (after ensuring that the HBase cluster has the fix).
-         */
-        if (groupScan.getHBaseConf().getBoolean("drill.hbase.supports.null.comparator", false))
{
-          if (args.get(0) instanceof SchemaPath) {
-            nodeScanSpec = createHBaseScanSpec(functionName, ((SchemaPath) args.get(0)),
null);
-          }
-        }
       }
     }
 
     if (nodeScanSpec == null) {
       allExpressionsConverted = false;
     }
+
     return nodeScanSpec;
   }
 
@@ -182,7 +168,8 @@ public class HBaseFilterBuilder extends AbstractExprVisitor<HBaseScanSpec,
Void,
     case "greater_than":
       compareOp = CompareOp.GREATER;
       if (isRowKey) {
-        startRow = fieldValue;
+        // startRow should be just greater than 'value'
+        startRow = Arrays.copyOf(fieldValue, fieldValue.length+1);
       }
       break;
     case "less_than_or_equal_to":
@@ -240,17 +227,4 @@ public class HBaseFilterBuilder extends AbstractExprVisitor<HBaseScanSpec,
Void,
     return null;
   }
 
-  private static final ImmutableMap<String, String> COMPARE_FUNCTIONS_TRANSPOSE_MAP;
-  static {
-   Builder<String, String> builder = ImmutableMap.builder();
-   COMPARE_FUNCTIONS_TRANSPOSE_MAP = builder
-       .put("equal", "equal")
-       .put("not_equal", "not_equal")
-       .put("greater_than_or_equal_to", "less_than_or_equal_to")
-       .put("greater_than", "less_than")
-       .put("less_than_or_equal_to", "greater_than_or_equal_to")
-       .put("less_than", "greater_than")
-       .build();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e9e63c4a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
index 3e91361..3881f4d 100644
--- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/HBaseTestsSuite.java
@@ -33,7 +33,6 @@ import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
-@Ignore("Need to fix HBaseRecordReader")
 @RunWith(Suite.class)
 @SuiteClasses({
   HBaseRecordReaderTest.class,

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e9e63c4a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java
b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java
index 6dd418c..76300b7 100644
--- a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseFilterPushDown.java
@@ -17,6 +17,10 @@
  */
 package org.apache.drill.hbase;
 
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Arrays;
+
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -56,15 +60,14 @@ public class TestHBaseFilterPushDown extends BaseHBaseTest {
   }
 
   @Test
-  @Ignore("Until convert_from() functions are working.")
   public void testFilterPushDownConvertExpression() throws Exception {
     runSQLVerifyCount("SELECT\n"
         + "  *\n"
         + "FROM\n"
         + "  hbase.`[TABLE_NAME]` tableName\n"
         + "WHERE\n"
-        + "  convert_from(row_key, 'INT_BE') > 12"
-        , -1);
+        + "  convert_from(row_key, 'UTF8') > 'b4'"
+        , 2);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e9e63c4a/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 731ab6b..b03882e 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
@@ -541,7 +541,7 @@ public class EvaluationVisitor {
 
     @Override
     public HoldingContainer visitConvertExpression(ConvertExpression e, ClassGenerator<?>
value) throws RuntimeException {
-      String convertFunctionName = e.getConvertFunction() + e.getConversionType();
+      String convertFunctionName = e.getConvertFunction() + e.getEncodingType();
 
       List<LogicalExpression> newArgs = Lists.newArrayList();
       newArgs.add(e.getInput());  //input_expr

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/e9e63c4a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java
index 0267be3..6297148 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java
@@ -326,7 +326,7 @@ public class ExpressionTreeMaterializer {
 
     @Override
     public LogicalExpression visitConvertExpression(ConvertExpression e, FunctionImplementationRegistry
value) {
-      String convertFunctionName = e.getConvertFunction() + e.getConversionType();
+      String convertFunctionName = e.getConvertFunction() + e.getEncodingType();
 
       List<LogicalExpression> newArgs = Lists.newArrayList();
       newArgs.add(e.getInput());  //input_expr


Mime
View raw message