Author: navis Date: Tue Jun 25 01:40:03 2013 New Revision: 1496332 URL: http://svn.apache.org/r1496332 Log: HIVE-4496 : JDBC2 won't compile with JDK7 (Chris Drome via Navis)
Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java?rev=1496332&r1=1496331&r2=1496332&view=diff ============================================================================== --- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java (original) +++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveCallableStatement.java Tue Jun 25 01:40:03 2013 @@ -462,6 +462,16 @@ public class HiveCallableStatement imple throw new SQLException("Method not supported"); } + public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException { + // TODO JDK 1.7 + throw new SQLException("Method not supported"); + } + + public <T> T getObject(String parameterName, Class<T> type) throws SQLException { + // TODO JDK 1.7 + throw new SQLException("Method not supported"); + } + /* * (non-Javadoc) * @@ -2030,6 +2040,16 @@ public class HiveCallableStatement imple throw new SQLException("Method not supported"); } + public void closeOnCompletion() throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + + public boolean isCloseOnCompletion() throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + /* * (non-Javadoc) * Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java?rev=1496332&r1=1496331&r2=1496332&view=diff ============================================================================== --- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java (original) +++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java Tue Jun 25 01:40:03 2013 @@ -33,6 +33,7 @@ import java.sql.SQLXML; import java.sql.Savepoint; import java.sql.Statement; import java.sql.Struct; +import java.util.concurrent.Executor; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -160,27 +161,32 @@ public class HiveConnection implements j } } - private void openSession(String uri) throws SQLException { - TOpenSessionReq openReq = new TOpenSessionReq(); + private void openSession(String uri) throws SQLException { + TOpenSessionReq openReq = new TOpenSessionReq(); - // set the session configuration - // openReq.setConfiguration(null); + // set the session configuration + // openReq.setConfiguration(null); - try { - TOpenSessionResp openResp = client.OpenSession(openReq); + try { + TOpenSessionResp openResp = client.OpenSession(openReq); - // validate connection - Utils.verifySuccess(openResp.getStatus()); - if (!supportedProtocols.contains(openResp.getServerProtocolVersion())) { - throw new TException("Unsupported Hive2 protocol"); - } - sessHandle = openResp.getSessionHandle(); - } catch (TException e) { - throw new SQLException("Could not establish connection to " - + uri + ": " + e.getMessage(), " 08S01", e); + // validate connection + Utils.verifySuccess(openResp.getStatus()); + if (!supportedProtocols.contains(openResp.getServerProtocolVersion())) { + throw new TException("Unsupported Hive2 protocol"); } - isClosed = false; + sessHandle = openResp.getSessionHandle(); + } catch (TException e) { + throw new SQLException("Could not establish connection to " + + uri + ": " + e.getMessage(), " 08S01", e); } + isClosed = false; + } + + public void abort(Executor executor) throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } /* * (non-Javadoc) @@ -395,6 +401,17 @@ public class HiveConnection implements j return new HiveDatabaseMetaData(client, sessHandle); } + public int getNetworkTimeout() throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + + + public String getSchema() throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + /* * (non-Javadoc) * @@ -663,6 +680,11 @@ public class HiveConnection implements j throw new SQLException("Method not supported"); } + public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + /* * (non-Javadoc) * @@ -696,6 +718,11 @@ public class HiveConnection implements j throw new SQLException("Method not supported"); } + public void setSchema(String schema) throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + /* * (non-Javadoc) * Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java?rev=1496332&r1=1496331&r2=1496332&view=diff ============================================================================== --- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java (original) +++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDataSource.java Tue Jun 25 01:40:03 2013 @@ -21,6 +21,8 @@ package org.apache.hive.jdbc; import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.logging.Logger; import javax.sql.DataSource; @@ -84,6 +86,11 @@ public class HiveDataSource implements D throw new SQLException("Method not supported"); } + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + // JDK 1.7 + throw new SQLFeatureNotSupportedException("Method not supported"); + } + /* * (non-Javadoc) * Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java?rev=1496332&r1=1496331&r2=1496332&view=diff ============================================================================== --- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java (original) +++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java Tue Jun 25 01:40:03 2013 @@ -144,6 +144,17 @@ public class HiveDatabaseMetaData implem throw new SQLException("Method not supported"); } + public ResultSet getPseudoColumns(String catalog, String schemaPattern, + String tableNamePattern, String columnNamePattern) throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + + public boolean generatedKeyAlwaysReturned() throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + /** * Convert a pattern containing JDBC catalog search wildcards into * Java regex patterns. @@ -709,6 +720,16 @@ public class HiveDatabaseMetaData implem public boolean next() throws SQLException { return false; } + + public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + + public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } }; } Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java?rev=1496332&r1=1496331&r2=1496332&view=diff ============================================================================== --- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java (original) +++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDriver.java Tue Jun 25 01:40:03 2013 @@ -24,9 +24,11 @@ import java.sql.Connection; import java.sql.Driver; import java.sql.DriverPropertyInfo; import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; import java.util.Properties; import java.util.jar.Attributes; import java.util.jar.Manifest; +import java.util.logging.Logger; import java.util.regex.Pattern; /** * HiveDriver. @@ -171,6 +173,11 @@ public class HiveDriver implements Drive return HiveDriver.getMinorDriverVersion(); } + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + // JDK 1.7 + throw new SQLFeatureNotSupportedException("Method not supported"); + } + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { if (info == null) { info = new Properties(); Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java?rev=1496332&r1=1496331&r2=1496332&view=diff ============================================================================== --- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java (original) +++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HivePreparedStatement.java Tue Jun 25 01:40:03 2013 @@ -858,6 +858,11 @@ public class HivePreparedStatement imple warningChain=null; } + public void closeOnCompletion() throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + /** * Closes the prepared statement. * @@ -1154,6 +1159,11 @@ public class HivePreparedStatement imple return isClosed; } + public boolean isCloseOnCompletion() throws SQLException { + //JDK 1.7 + throw new SQLException("Method not supported"); + } + /* * (non-Javadoc) * Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java?rev=1496332&r1=1496331&r2=1496332&view=diff ============================================================================== --- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java (original) +++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveQueryResultSet.java Tue Jun 25 01:40:03 2013 @@ -274,4 +274,13 @@ public class HiveQueryResultSet extends return fetchSize; } + public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { + //JDK 1.7 + throw new SQLException("Method not supported"); + } + + public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { + //JDK 1.7 + throw new SQLException("Method not supported"); + } } Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java?rev=1496332&r1=1496331&r2=1496332&view=diff ============================================================================== --- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java (original) +++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java Tue Jun 25 01:40:03 2013 @@ -163,6 +163,11 @@ public class HiveStatement implements ja isClosed = true; } + public void closeOnCompletion() throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + /* * (non-Javadoc) * @@ -450,6 +455,11 @@ public class HiveStatement implements ja return isClosed; } + public boolean isCloseOnCompletion() throws SQLException { + // JDK 1.7 + throw new SQLException("Method not supported"); + } + /* * (non-Javadoc) *