drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansi...@apache.org
Subject [1/2] drill git commit: DRILL-2590: In implicit casting rule, make boolean to be implicitly castable from boolean only
Date Wed, 01 Apr 2015 17:46:18 GMT
Repository: drill
Updated Branches:
  refs/heads/master 7b11e3e8f -> d05ff9d84


DRILL-2590: In implicit casting rule, make boolean to be implicitly castable from boolean
only


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

Branch: refs/heads/master
Commit: 451bc5ae024defec4e2f61e6fc0c3886cd80ec4c
Parents: 7b11e3e
Author: Hsuan-Yi Chu <hsuanyi@usc.edu>
Authored: Fri Mar 27 13:38:50 2015 -0700
Committer: Aman Sinha <asinha@maprtech.com>
Committed: Wed Apr 1 10:32:37 2015 -0700

----------------------------------------------------------------------
 .../drill/exec/resolver/TypeCastRules.java      | 23 --------------------
 .../java/org/apache/drill/TestUnionAll.java     | 14 ++++++++++++
 .../test/resources/store/json/booleanData.json  |  2 ++
 .../src/test/resources/store/json/intData.json  |  2 ++
 4 files changed, 18 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/451bc5ae/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java
index 8fc6612..d8652f2 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/resolver/TypeCastRules.java
@@ -546,30 +546,7 @@ public class TypeCastRules {
     /** BIT cast able from **/
     rule = new HashSet<MinorType>();
     rule.add(MinorType.TINYINT);
-    rule.add(MinorType.SMALLINT);
-    rule.add(MinorType.INT);
-    rule.add(MinorType.BIGINT);
-    rule.add(MinorType.UINT1);
-    rule.add(MinorType.UINT2);
-    rule.add(MinorType.UINT4);
-    rule.add(MinorType.UINT8);
-    rule.add(MinorType.DECIMAL9);
-    rule.add(MinorType.DECIMAL18);
-    rule.add(MinorType.DECIMAL28SPARSE);
-    rule.add(MinorType.DECIMAL28DENSE);
-    rule.add(MinorType.DECIMAL38SPARSE);
-    rule.add(MinorType.DECIMAL38DENSE);
-    rule.add(MinorType.MONEY);
-    rule.add(MinorType.TIMESTAMPTZ);
-    rule.add(MinorType.FLOAT4);
-    rule.add(MinorType.FLOAT8);
     rule.add(MinorType.BIT);
-    rule.add(MinorType.FIXEDCHAR);
-    rule.add(MinorType.FIXED16CHAR);
-    rule.add(MinorType.VARCHAR);
-    rule.add(MinorType.VAR16CHAR);
-    rule.add(MinorType.VARBINARY);
-    rule.add(MinorType.FIXEDBINARY);
     rules.put(MinorType.BIT, rule);
 
     /** FIXEDCHAR cast able from **/

http://git-wip-us.apache.org/repos/asf/drill/blob/451bc5ae/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java b/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
index 1ebb534..fcf5c9f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
@@ -19,6 +19,7 @@ package org.apache.drill;
 
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.util.FileUtils;
+import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.work.foreman.SqlUnsupportedException;
 import org.apache.drill.exec.work.foreman.UnsupportedRelOperatorException;
 import org.junit.Test;
@@ -354,4 +355,17 @@ public class TestUnionAll extends BaseTestQuery{
         .baselineColumns("calc1", "min", "max", "count")
         .build().run();
   }
+
+  @Test(expected = RpcException.class) // see DRILL-2590
+  public void testUnionAllImplicitCastingFailure() throws Exception {
+    String rootInt = FileUtils.getResourceAsFile("/store/json/intData.json").toURI().toString();
+    String rootBoolean = FileUtils.getResourceAsFile("/store/json/booleanData.json").toURI().toString();
+
+    String query = String.format(
+        "(select key from dfs_test.`%s` " +
+        "union all " +
+        "select key from dfs_test.`%s` )", rootInt, rootBoolean);
+
+    test(query);
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/451bc5ae/exec/java-exec/src/test/resources/store/json/booleanData.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/store/json/booleanData.json b/exec/java-exec/src/test/resources/store/json/booleanData.json
new file mode 100644
index 0000000..63be3a1
--- /dev/null
+++ b/exec/java-exec/src/test/resources/store/json/booleanData.json
@@ -0,0 +1,2 @@
+{"key":true}
+{"key":false}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/451bc5ae/exec/java-exec/src/test/resources/store/json/intData.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/store/json/intData.json b/exec/java-exec/src/test/resources/store/json/intData.json
new file mode 100644
index 0000000..b28b287
--- /dev/null
+++ b/exec/java-exec/src/test/resources/store/json/intData.json
@@ -0,0 +1,2 @@
+{"key":52459253098448904}
+{"key":1116675951}
\ No newline at end of file


Mime
View raw message