You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by th...@apache.org on 2013/09/17 22:38:51 UTC
svn commit: r1524215 - in /hive/branches/branch-0.12:
common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
conf/hive-default.xml.template
jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java
Author: thejas
Date: Tue Sep 17 20:38:50 2013
New Revision: 1524215
URL: http://svn.apache.org/r1524215
Log:
HIVE-4998 support jdbc documented table types in default configuration (Thejas Nair via Harish Butani)
Modified:
hive/branches/branch-0.12/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
hive/branches/branch-0.12/conf/hive-default.xml.template
hive/branches/branch-0.12/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java
Modified: hive/branches/branch-0.12/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.12/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java?rev=1524215&r1=1524214&r2=1524215&view=diff
==============================================================================
--- hive/branches/branch-0.12/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (original)
+++ hive/branches/branch-0.12/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java Tue Sep 17 20:38:50 2013
@@ -757,7 +757,7 @@ public class HiveConf extends Configurat
HIVE_SERVER2_PLAIN_LDAP_DOMAIN("hive.server2.authentication.ldap.Domain", null),
HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS("hive.server2.custom.authentication.class", null),
HIVE_SERVER2_ENABLE_DOAS("hive.server2.enable.doAs", true),
- HIVE_SERVER2_TABLE_TYPE_MAPPING("hive.server2.table.type.mapping", "HIVE"),
+ HIVE_SERVER2_TABLE_TYPE_MAPPING("hive.server2.table.type.mapping", "CLASSIC"),
HIVE_SERVER2_SESSION_HOOK("hive.server2.session.hook", ""),
HIVE_CONF_RESTRICTED_LIST("hive.conf.restricted.list", null),
Modified: hive/branches/branch-0.12/conf/hive-default.xml.template
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.12/conf/hive-default.xml.template?rev=1524215&r1=1524214&r2=1524215&view=diff
==============================================================================
--- hive/branches/branch-0.12/conf/hive-default.xml.template (original)
+++ hive/branches/branch-0.12/conf/hive-default.xml.template Tue Sep 17 20:38:50 2013
@@ -1955,7 +1955,7 @@
<property>
<name>hive.server2.table.type.mapping</name>
- <value>HIVE</value>
+ <value>CLASSIC</value>
<description>
This setting reflects how HiveServer will report the table types for JDBC and other
client implementations that retrieves the available tables and supported table types
Modified: hive/branches/branch-0.12/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.12/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java?rev=1524215&r1=1524214&r2=1524215&view=diff
==============================================================================
--- hive/branches/branch-0.12/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java (original)
+++ hive/branches/branch-0.12/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java Tue Sep 17 20:38:50 2013
@@ -789,7 +789,7 @@ public class TestJdbcDriver2 extends Tes
}
public void testMetaDataGetTables() throws SQLException {
- getTablesTest(TableType.MANAGED_TABLE.toString(), TableType.VIRTUAL_VIEW.toString());
+ getTablesTest(ClassicTableTypes.TABLE.toString(), ClassicTableTypes.VIEW.toString());
}
public void testMetaDataGetTablesHive() throws SQLException {
@@ -807,6 +807,13 @@ public class TestJdbcDriver2 extends Tes
getTablesTest(ClassicTableTypes.TABLE.toString(), ClassicTableTypes.VIEW.toString());
}
+ /**
+ * Test the type returned for pre-created table type table and view type
+ * table
+ * @param tableTypeName expected table type
+ * @param viewTypeName expected view type
+ * @throws SQLException
+ */
private void getTablesTest(String tableTypeName, String viewTypeName) throws SQLException {
Map<String, Object[]> tests = new HashMap<String, Object[]>();
tests.put("test%jdbc%", new Object[]{"testhivejdbcdriver_table"
@@ -887,10 +894,14 @@ public class TestJdbcDriver2 extends Tes
rs.close();
}
+ //test default table types returned in
+ // Connection.getMetaData().getTableTypes()
public void testMetaDataGetTableTypes() throws SQLException {
- metaDataGetTableTypeTest(new HiveTableTypeMapping().getTableTypeNames());
+ metaDataGetTableTypeTest(new ClassicTableTypeMapping().getTableTypeNames());
}
+ //test default table types returned in
+ // Connection.getMetaData().getTableTypes() when type config is set to "HIVE"
public void testMetaDataGetHiveTableTypes() throws SQLException {
Statement stmt = con.createStatement();
stmt.execute("set " + HiveConf.ConfVars.HIVE_SERVER2_TABLE_TYPE_MAPPING.varname +
@@ -899,6 +910,8 @@ public class TestJdbcDriver2 extends Tes
metaDataGetTableTypeTest(new HiveTableTypeMapping().getTableTypeNames());
}
+ //test default table types returned in
+ // Connection.getMetaData().getTableTypes() when type config is set to "CLASSIC"
public void testMetaDataGetClassicTableTypes() throws SQLException {
Statement stmt = con.createStatement();
stmt.execute("set " + HiveConf.ConfVars.HIVE_SERVER2_TABLE_TYPE_MAPPING.varname +
@@ -907,6 +920,12 @@ public class TestJdbcDriver2 extends Tes
metaDataGetTableTypeTest(new ClassicTableTypeMapping().getTableTypeNames());
}
+ /**
+ * Test if Connection.getMetaData().getTableTypes() returns expected
+ * tabletypes
+ * @param tabletypes expected table types
+ * @throws SQLException
+ */
private void metaDataGetTableTypeTest(Set<String> tabletypes)
throws SQLException {
ResultSet rs = (ResultSet)con.getMetaData().getTableTypes();