drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prog...@apache.org
Subject [4/9] drill git commit: DRILL-5792: CONVERT_FROM_JSON on an empty file throws runtime exception
Date Mon, 02 Oct 2017 17:30:46 GMT
DRILL-5792: CONVERT_FROM_JSON on an empty file throws runtime exception

closes #961


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

Branch: refs/heads/master
Commit: 4ae7885f5456ce173a288b1720471da12ba5ed7a
Parents: d59421b
Author: Vitalii Diravka <vitalii.diravka@gmail.com>
Authored: Tue Sep 26 04:06:45 2017 -0700
Committer: Paul Rogers <progers@maprtech.com>
Committed: Sat Sep 30 19:08:26 2017 -0700

----------------------------------------------------------------------
 .../java-exec/src/main/codegen/templates/TypeHelper.java |  1 +
 exec/jdbc/pom.xml                                        |  1 +
 .../java/org/apache/drill/jdbc/test/TestJdbcQuery.java   | 11 +++++++++--
 exec/jdbc/src/test/resources/empty.csv                   |  0
 4 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/4ae7885f/exec/java-exec/src/main/codegen/templates/TypeHelper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/TypeHelper.java b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
index 5ccda85..e4c8f33 100644
--- a/exec/java-exec/src/main/codegen/templates/TypeHelper.java
+++ b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
@@ -61,6 +61,7 @@ public class TypeHelper extends BasicTypeHelper {
     </#list>
     case MAP:
     case LIST:
+    case NULL:
       return new GenericAccessor(vector);
     }
     throw new UnsupportedOperationException(buildErrorMessage("find sql accessor", type));

http://git-wip-us.apache.org/repos/asf/drill/blob/4ae7885f/exec/jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/exec/jdbc/pom.xml b/exec/jdbc/pom.xml
index c3c48fa..71862f6 100644
--- a/exec/jdbc/pom.xml
+++ b/exec/jdbc/pom.xml
@@ -119,6 +119,7 @@
             <exclude>**/.checkstyle</exclude>
             <exclude>**/.buildpath</exclude>
             <exclude>**/*.json</exclude>
+            <exclude>**/*.csv</exclude>
             <exclude>**/*.iml</exclude>
             <exclude>**/git.properties</exclude>
             <exclude>**/donuts-output-data.txt</exclude>

http://git-wip-us.apache.org/repos/asf/drill/blob/4ae7885f/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
index 1dd172f..894e06f 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
@@ -370,7 +370,7 @@ public class TestJdbcQuery extends JdbcTestQueryBase {
 
   @Test // DRILL-1051
   public void testOldDateTimeJulianCalendar() throws Exception {
-    // Should be work with any timezone
+    // Should work with any timezone
     JdbcAssert.withNoDefaultSchema()
         .sql("select cast(to_timestamp('1581-12-01 23:32:01', 'yyyy-MM-dd HH:mm:ss') as date)
as `DATE`, " +
             "to_timestamp('1581-12-01 23:32:01', 'yyyy-MM-dd HH:mm:ss') as `TIMESTAMP`, "
+
@@ -381,7 +381,7 @@ public class TestJdbcQuery extends JdbcTestQueryBase {
 
   @Test // DRILL-1051
   public void testOldDateTimeLocalMeanTime() throws Exception {
-    // Should be work with any timezone
+    // Should work with any timezone
     JdbcAssert.withNoDefaultSchema()
         .sql("select cast(to_timestamp('1883-11-16 01:32:01', 'yyyy-MM-dd HH:mm:ss') as date)
as `DATE`, " +
             "to_timestamp('1883-11-16 01:32:01', 'yyyy-MM-dd HH:mm:ss') as `TIMESTAMP`, "
+
@@ -390,4 +390,11 @@ public class TestJdbcQuery extends JdbcTestQueryBase {
         .returns("DATE=1883-11-16; TIMESTAMP=1883-11-16 01:32:01.0; TIME=01:32:01");
   }
 
+  @Test // DRILL-5792
+  public void testConvertFromInEmptyInputSql() throws Exception {
+    JdbcAssert.withNoDefaultSchema()
+        .sql("SELECT CONVERT_FROM(columns[1], 'JSON') as col1 from cp.`empty.csv`")
+        .returns("");
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/4ae7885f/exec/jdbc/src/test/resources/empty.csv
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/resources/empty.csv b/exec/jdbc/src/test/resources/empty.csv
new file mode 100644
index 0000000..e69de29


Mime
View raw message