diff --git a/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java b/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java index e492663..ec37ba6 100644 --- a/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java +++ b/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java @@ -708,6 +708,38 @@ public void testMetaDataGetTableTypes() throws SQLException { assertTrue("Found less tabletypes then we test for.", cnt >= tabletypes.size()); } + public void testMetaDataGetTypeInfo() throws SQLException { + HiveBaseResultSet rs = (HiveBaseResultSet) con.getMetaData().getTypeInfo(); + Set typeInfos = new HashSet(); + 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()); + } + + public void testMetaDataGetColumns() throws SQLException { Map tests = new HashMap(); tests.put(new String[]{"testhivejdbcdriver\\_table", null}, 2);