drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meh...@apache.org
Subject [1/2] drill git commit: DRILL-2433: Add support for implicit casting between date and timestamp in join condition
Date Wed, 06 May 2015 21:36:34 GMT
Repository: drill
Updated Branches:
  refs/heads/master e58696a93 -> 31e51832d


DRILL-2433: Add support for implicit casting between date and timestamp in join condition


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

Branch: refs/heads/master
Commit: 3ab96833c364075e3728994369eea67106732190
Parents: e58696a
Author: Mehant Baid <mehantr@gmail.com>
Authored: Wed Apr 29 10:38:52 2015 -0700
Committer: Mehant Baid <mehantr@gmail.com>
Committed: Wed May 6 10:58:37 2015 -0700

----------------------------------------------------------------------
 .../drill/exec/physical/impl/join/JoinUtils.java     |   6 ++++++
 .../physical/impl/join/TestHashJoinAdvanced.java     |  11 +++++++++++
 .../physical/impl/join/TestMergeJoinAdvanced.java    |  11 +++++++++++
 .../test/resources/parquet/timestamp_table.parquet   | Bin 0 -> 183 bytes
 4 files changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/3ab96833/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinUtils.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinUtils.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinUtils.java
index 0af0ddb..3925370 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinUtils.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/JoinUtils.java
@@ -138,6 +138,12 @@ public class JoinUtils {
       return true;
     }
 
+    // allow implicit cast if input types are date/ timestamp
+    if ((input1 == TypeProtos.MinorType.DATE || input1 == TypeProtos.MinorType.TIMESTAMP)
&&
+        (input2 == TypeProtos.MinorType.DATE || input2 == TypeProtos.MinorType.TIMESTAMP))
{
+      return true;
+    }
+
     // allow implicit cast if both the input types are varbinary/ varchar
     if ((input1 == TypeProtos.MinorType.VARCHAR || input1 == TypeProtos.MinorType.VARBINARY)
&&
         (input2 == TypeProtos.MinorType.VARCHAR || input2 == TypeProtos.MinorType.VARBINARY))
{

http://git-wip-us.apache.org/repos/asf/drill/blob/3ab96833/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoinAdvanced.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoinAdvanced.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoinAdvanced.java
index 905fd1b..a70a3f8 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoinAdvanced.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestHashJoinAdvanced.java
@@ -114,5 +114,16 @@ public class TestHashJoinAdvanced extends BaseTestQuery {
         .baselineColumns("bigint_col")
         .baselineValues(1l)
         .go();
+
+    query = "select count(*) col1 from " +
+        "(select t1.date_opt from cp.`parquet/date_dictionary.parquet` t1, cp.`parquet/timestamp_table.parquet`
t2 " +
+        "where t1.date_opt = t2.timestamp_col)"; // join condition contains date and timestamp
+
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .baselineColumns("col1")
+        .baselineValues(4l)
+        .go();
   }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/3ab96833/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
index a092ca7..c706638 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
@@ -61,5 +61,16 @@ public class TestMergeJoinAdvanced extends BaseTestQuery {
         .baselineColumns("bigint_col")
         .baselineValues(1l)
         .go();
+
+    query = "select count(*) col1 from " +
+        "(select t1.date_opt from cp.`parquet/date_dictionary.parquet` t1, cp.`parquet/timestamp_table.parquet`
t2 " +
+        "where t1.date_opt = t2.timestamp_col)"; // join condition contains date and timestamp
+
+    testBuilder()
+        .sqlQuery(query)
+        .unOrdered()
+        .baselineColumns("col1")
+        .baselineValues(4l)
+        .go();
   }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/3ab96833/exec/java-exec/src/test/resources/parquet/timestamp_table.parquet
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/parquet/timestamp_table.parquet b/exec/java-exec/src/test/resources/parquet/timestamp_table.parquet
new file mode 100644
index 0000000..14ad79f
Binary files /dev/null and b/exec/java-exec/src/test/resources/parquet/timestamp_table.parquet
differ


Mime
View raw message