drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject [2/3] drill git commit: DRILL-2466: Fix "<a>.VARCHAR -> <b>.NVARCHAR" to "-> <b>.VARCHAR" (Types.h).
Date Tue, 24 Mar 2015 02:30:43 GMT
DRILL-2466: Fix "<a>.VARCHAR -> <b>.NVARCHAR" to "-> <b>.VARCHAR" (Types.h).

- Fixed mapping from TypeProtos.MinorType.VARCHAR to java.sql.Types.NVARCHAR
  to be to java.sql.Types.VARCHAR.
- Also renamed getSqlType to getJdbcType, getSqlTypeName to getSqlTypeName.


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

Branch: refs/heads/master
Commit: 544988f2ac99fa19807108494655a54faf358b17
Parents: 64ad7a7
Author: dbarclay <dbarclay@maprtech.com>
Authored: Sun Mar 15 13:32:00 2015 -0700
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Mon Mar 23 18:41:32 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/drill/blob/544988f2/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 04fec54..f29f1ec 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
@@ -82,12 +82,15 @@ public class Types {
     }
   }
 
-  public static int getSqlType(MajorType type) {
+  /***
+   * Gets JDBC type code for given Drill RPC-/protobuf-level type.
+   */
+  public static int getJdbcType(MajorType type) {
     if (type.getMode() == DataMode.REPEATED) {
       return java.sql.Types.ARRAY;
     }
 
-    switch(type.getMinorType()) {
+    switch (type.getMinorType()) {
     case BIGINT:
       return java.sql.Types.BIGINT;
     case BIT:
@@ -146,9 +149,13 @@ public class Types {
     case VARBINARY:
       return java.sql.Types.VARBINARY;
     case VARCHAR:
-      return java.sql.Types.NVARCHAR;
+      return java.sql.Types.VARCHAR;
     default:
-      throw new UnsupportedOperationException();
+      // TODO:  This isn't really an unsupported-operation/-type case; this
+      //   is an unexpected, code-out-of-sync-with-itself case, so use an
+      //   exception intended for that.
+      throw new UnsupportedOperationException(
+          "Unexpected/unhandled " + type.getMinorType() + " value " + type.getMinorType()
);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/544988f2/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java
index e75be70..40c7ae7 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java
@@ -82,11 +82,11 @@ public class DrillColumnMetaDataList extends BasicList<ColumnMetaData>{
   }
 
   private static AvaticaType getAvaticaType(MajorType t){
-    int sqlTypeId = Types.getSqlType(t);
-    return ColumnMetaData.scalar(sqlTypeId, getSqlTypeName(sqlTypeId), Rep.BOOLEAN /* dummy
value, unused */);
+    final int jdbcTypeId = Types.getJdbcType(t);
+    return ColumnMetaData.scalar(jdbcTypeId, getJdbcTypeName(jdbcTypeId), Rep.BOOLEAN /*
dummy value, unused */);
   }
 
-  private static String getSqlTypeName(int type) {
+  private static String getJdbcTypeName(int type) {
     switch (type) {
     case java.sql.Types.BIT:
         return "BIT";


Mime
View raw message