hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject [24/44] hive git commit: HIVE-3173 Add tests for JDBC getTypeInfo method (Xiu Gao via gates)
Date Sat, 01 Oct 2016 01:09:06 GMT
HIVE-3173 Add tests for JDBC getTypeInfo method (Xiu Gao via gates)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/19fd5613
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/19fd5613
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/19fd5613

Branch: refs/heads/hive-14535
Commit: 19fd56137caa23fbe8ef1e452a11603fc14f4325
Parents: 4ce5fe1
Author: Alan Gates <gates@hortonworks.com>
Authored: Mon Sep 26 10:47:48 2016 -0700
Committer: Alan Gates <gates@hortonworks.com>
Committed: Mon Sep 26 10:47:48 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hive/jdbc/TestJdbcDriver2.java   | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/19fd5613/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java
index fc91f9d..ff4d63f 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java
@@ -1145,6 +1145,38 @@ public class TestJdbcDriver2 {
     assertFalse("Unexpected table", rs.next());
   }
 
+  @Test
+  public void testMetaDataGetTypeInfo() throws SQLException {
+    HiveBaseResultSet rs = (HiveBaseResultSet) con.getMetaData().getTypeInfo();
+    Set<String> typeInfos = new HashSet<String>();
+    typeInfos.add("BOOLEAN");
+    typeInfos.add("TINYINT");
+    typeInfos.add("SMALLINT");
+    typeInfos.add("INT");
+    typeInfos.add("BIGINT");
+    typeInfos.add("FLOAT");
+    typeInfos.add("DOUBLE");
+    typeInfos.add("STRING");
+    typeInfos.add("TIMESTAMP");
+    typeInfos.add("BINARY");
+    typeInfos.add("DECIMAL");
+    typeInfos.add("ARRAY");
+    typeInfos.add("MAP");
+    typeInfos.add("STRUCT");
+    typeInfos.add("UNIONTYPE");
+
+    int cnt = 0;
+    while (rs.next()) {
+      String typeInfo = rs.getString("TYPE_NAME");
+      assertEquals("Get by index different from get by name", rs.getString(1), typeInfo);
+      typeInfos.remove(typeInfo);
+      cnt++;
+    }
+    rs.close();
+    assertEquals("Incorrect typeInfo count.", 0, typeInfos.size());
+    assertTrue("Found less typeInfos than we test for.", cnt >= typeInfos.size());
+  }
+
   /**
    * Test the type returned for pre-created table type table and view type table
    * @param tableTypeNames expected table types


Mime
View raw message