You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by rh...@apache.org on 2013/09/16 20:15:56 UTC
svn commit: r1523741 - in /hive/trunk:
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: rhbutani
Date: Mon Sep 16 18:15:56 2013
New Revision: 1523741
URL: http://svn.apache.org/r1523741
Log:
HIVE-4998 support jdbc documented table types in default configuration (Thejas Nair via Harish Butani)
Modified:
hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
hive/trunk/conf/hive-default.xml.template
hive/trunk/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java
Modified: hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java?rev=1523741&r1=1523740&r2=1523741&view=diff
==============================================================================
--- hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (original)
+++ hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java Mon Sep 16 18:15:56 2013
@@ -758,7 +758,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/trunk/conf/hive-default.xml.template
URL: http://svn.apache.org/viewvc/hive/trunk/conf/hive-default.xml.template?rev=1523741&r1=1523740&r2=1523741&view=diff
==============================================================================
--- hive/trunk/conf/hive-default.xml.template (original)
+++ hive/trunk/conf/hive-default.xml.template Mon Sep 16 18:15:56 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/trunk/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java
URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java?rev=1523741&r1=1523740&r2=1523741&view=diff
==============================================================================
--- hive/trunk/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java (original)
+++ hive/trunk/jdbc/src/test/org/apache/hive/jdbc/TestJdbcDriver2.java Mon Sep 16 18:15:56 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();