drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhe...@apache.org
Subject [2/4] drill git commit: DRILL-4945: Report INTERVAL exact type as column type name
Date Sat, 05 Nov 2016 01:01:28 GMT
DRILL-4945: Report INTERVAL exact type as column type name

closes #618


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

Branch: refs/heads/master
Commit: 2365ac05524e21b2d084e5138e70a24092fe1bd8
Parents: 9411b26
Author: Laurent Goujon <laurent@dremio.com>
Authored: Fri Oct 14 11:27:28 2016 -0700
Committer: Sudheesh Katkam <skatkam@maprtech.com>
Committed: Fri Nov 4 17:17:05 2016 -0700

----------------------------------------------------------------------
 .../org/apache/drill/common/types/Types.java    |  6 +++--
 .../drill/jdbc/ResultSetMetaDataTest.java       | 23 ++++++++++----------
 2 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/2365ac05/common/src/main/java/org/apache/drill/common/types/Types.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/types/Types.java b/common/src/main/java/org/apache/drill/common/types/Types.java
index ce2abf9..3ebefd5 100644
--- a/common/src/main/java/org/apache/drill/common/types/Types.java
+++ b/common/src/main/java/org/apache/drill/common/types/Types.java
@@ -135,8 +135,8 @@ public class Types {
       case TIMESTAMP:       return "TIMESTAMP";
       case TIMESTAMPTZ:     return "TIMESTAMP WITH TIME ZONE";
 
-      case INTERVALYEAR:
-      case INTERVALDAY:     return "INTERVAL";
+      case INTERVALYEAR:    return "INTERVAL YEAR TO MONTH";
+      case INTERVALDAY:     return "INTERVAL DAY TO SECOND";
 
       // Non-standard SQL atomic data types:
 
@@ -185,6 +185,8 @@ public class Types {
       case "FLOAT":                         return java.sql.Types.FLOAT;
       case "INTEGER":                       return java.sql.Types.INTEGER;
       case "INTERVAL":                      return java.sql.Types.OTHER;  // JDBC (4.1) has
nothing for INTERVAL
+      case "INTERVAL YEAR TO MONTH":        return java.sql.Types.OTHER;
+      case "INTERVAL DAY TO SECOND":        return java.sql.Types.OTHER;
       case "MAP":                           return java.sql.Types.OTHER; // Drill doesn't
support java.sql.Struct
       case "NATIONAL CHARACTER VARYING":    return java.sql.Types.NVARCHAR;
       case "NATIONAL CHARACTER":            return java.sql.Types.NCHAR;

http://git-wip-us.apache.org/repos/asf/drill/blob/2365ac05/exec/jdbc/src/test/java/org/apache/drill/jdbc/ResultSetMetaDataTest.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/ResultSetMetaDataTest.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/ResultSetMetaDataTest.java
index d8800fb..3632528 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/ResultSetMetaDataTest.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/ResultSetMetaDataTest.java
@@ -17,29 +17,28 @@
  */
 package org.apache.drill.jdbc;
 
-import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.anyOf;
+import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
-import static org.hamcrest.CoreMatchers.*;
-
-import org.apache.drill.jdbc.Driver;
-import org.apache.drill.jdbc.test.JdbcAssert;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
 
 import java.math.BigDecimal;
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Time;
 import java.sql.Timestamp;
-import java.sql.SQLException;
 import java.sql.Types;
 
+import org.apache.drill.jdbc.test.JdbcAssert;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
 
 /**
  * Test class for Drill's java.sql.ResultSetMetaData implementation.
@@ -788,13 +787,13 @@ public class ResultSetMetaDataTest extends JdbcTestBase {
   @Test
   public void test_getColumnTypeName_forINTERVAL_Y() throws SQLException {
     assertThat( rowMetadata.getColumnTypeName( ordReqINTERVAL_Y ),
-                equalTo( "INTERVAL" ) );
+                equalTo( "INTERVAL YEAR TO MONTH" ) );
   }
 
   @Test
   public void test_getColumnTypeName_forINTERVAL_D() throws SQLException {
     assertThat( rowMetadata.getColumnTypeName( ordReqINTERVAL_4D_H ),
-                equalTo( "INTERVAL" ) );
+                equalTo( "INTERVAL DAY TO SECOND" ) );
   }
 
   // TODO(DRILL-3253):  Do more types when we have all-types test storage plugin.


Mime
View raw message