drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meh...@apache.org
Subject drill git commit: DRILL-1496: Fix serialization of 'similar to' while converting from optiq expression to drill.
Date Wed, 25 Feb 2015 05:53:15 GMT
Repository: drill
Updated Branches:
  refs/heads/master 01667a26d -> 8bb6b08e5


DRILL-1496: Fix serialization of 'similar to' while converting from optiq expression to drill.


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

Branch: refs/heads/master
Commit: 8bb6b08e59c8fae0dc5ab0a8dc5fe63b60d122ec
Parents: 01667a2
Author: Mehant Baid <mehantr@gmail.com>
Authored: Fri Feb 20 15:45:54 2015 -0800
Committer: Mehant Baid <mehantr@gmail.com>
Committed: Tue Feb 24 17:16:39 2015 -0800

----------------------------------------------------------------------
 .../common/expression/FunctionCallFactory.java  |  1 +
 .../exec/expr/fn/impl/StringFunctions.java      |  4 ++--
 .../org/apache/drill/TestExampleQueries.java    | 20 ++++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/8bb6b08e/common/src/main/java/org/apache/drill/common/expression/FunctionCallFactory.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/expression/FunctionCallFactory.java
b/common/src/main/java/org/apache/drill/common/expression/FunctionCallFactory.java
index 64432ca..422800b 100644
--- a/common/src/main/java/org/apache/drill/common/expression/FunctionCallFactory.java
+++ b/common/src/main/java/org/apache/drill/common/expression/FunctionCallFactory.java
@@ -56,6 +56,7 @@ public class FunctionCallFactory {
     opToFuncTable.put("is not true", "isnottrue");
     opToFuncTable.put("is false", "isfalse");
     opToFuncTable.put("is not false", "isnotfalse");
+    opToFuncTable.put("similar to", "similar_to");
 
     opToFuncTable.put("!", "not");
     opToFuncTable.put("u-", "negative");

http://git-wip-us.apache.org/repos/asf/drill/blob/8bb6b08e/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
index 83e812d..7ba4a30 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
@@ -91,7 +91,7 @@ public class StringFunctions{
     }
   }
 
-  @FunctionTemplate(names = {"similar", "similar to"}, scope = FunctionScope.SIMPLE, nulls
= NullHandling.NULL_IF_NULL)
+  @FunctionTemplate(names = {"similar", "similar_to"}, scope = FunctionScope.SIMPLE, nulls
= NullHandling.NULL_IF_NULL)
   public static class Similar implements DrillSimpleFunc{
     @Param VarCharHolder input;
     @Param(constant=true) VarCharHolder pattern;
@@ -110,7 +110,7 @@ public class StringFunctions{
     }
   }
 
-  @FunctionTemplate(names = {"similar", "similar to"}, scope = FunctionScope.SIMPLE, nulls
= NullHandling.NULL_IF_NULL)
+  @FunctionTemplate(names = {"similar", "similar_to"}, scope = FunctionScope.SIMPLE, nulls
= NullHandling.NULL_IF_NULL)
   public static class SimilarWithEscape implements DrillSimpleFunc{
     @Param VarCharHolder input;
     @Param(constant=true) VarCharHolder pattern;

http://git-wip-us.apache.org/repos/asf/drill/blob/8bb6b08e/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 a54200d..c59d0af 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
@@ -22,6 +22,8 @@ import static org.junit.Assert.assertEquals;
 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.Ignore;
 import org.junit.Test;
 
@@ -618,4 +620,22 @@ public class TestExampleQueries extends BaseTestQuery{
         .run();
   }
 
+  @Test
+  public void testSimilar() throws Exception {
+    String query = "select n_nationkey " +
+        "from cp.`tpch/nation.parquet` " +
+        "where n_name similar to 'CHINA' " +
+        "order by n_regionkey";
+
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .optionSettingQueriesForTestQuery("alter session set `planner.slice_target` = 1")
+        .baselineColumns("n_nationkey")
+        .baselineValues(18)
+        .go();
+
+    test("alter session set `planner.slice_target` = " + ExecConstants.SLICE_TARGET_DEFAULT);
+  }
+
 }


Mime
View raw message