You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2013/06/02 18:47:45 UTC
svn commit: r1488740 - in /hive/trunk: jdbc/src/java/org/apache/hive/jdbc/
ql/src/java/org/apache/hadoop/hive/ql/
service/src/java/org/apache/hive/service/cli/operation/
Author: hashutosh
Date: Sun Jun 2 16:47:45 2013
New Revision: 1488740
URL: http://svn.apache.org/r1488740
Log:
HIVE-4510 : HS2 doesn't nest exceptions properly (fun debug times) (Thejas Nair via Ashutosh Chauhan)
Modified:
hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java
hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java
hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveDatabaseMetaData.java
hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
hive/trunk/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java
hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
Modified: hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java
URL: http://svn.apache.org/viewvc/hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java?rev=1488740&r1=1488739&r2=1488740&view=diff
==============================================================================
--- hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java (original)
+++ hive/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveBaseResultSet.java Sun Jun 2 16:47:45 2013
@@ -229,7 +229,7 @@ public abstract class HiveBaseResultSet
return Date.valueOf((String) obj);
} catch (Exception e) {
throw new SQLException("Cannot convert column " + columnIndex
- + " to date: " + e.toString());
+ + " to date: " + e.toString(), e);
}
}
@@ -258,7 +258,7 @@ public abstract class HiveBaseResultSet
throw new Exception("Illegal conversion");
} catch (Exception e) {
throw new SQLException("Cannot convert column " + columnIndex
- + " to double: " + e.toString());
+ + " to double: " + e.toString(), e);
}
}
@@ -287,7 +287,7 @@ public abstract class HiveBaseResultSet
throw new Exception("Illegal conversion");
} catch (Exception e) {
throw new SQLException("Cannot convert column " + columnIndex
- + " to float: " + e.toString());
+ + " to float: " + e.toString(), e);
}
}
@@ -311,7 +311,9 @@ public abstract class HiveBaseResultSet
}
throw new Exception("Illegal conversion");
} catch (Exception e) {
- throw new SQLException("Cannot convert column " + columnIndex + " to integer" + e.toString());
+ throw new SQLException(
+ "Cannot convert column " + columnIndex + " to integer" + e.toString(),
+ e);
}
}
@@ -331,7 +333,9 @@ public abstract class HiveBaseResultSet
}
throw new Exception("Illegal conversion");
} catch (Exception e) {
- throw new SQLException("Cannot convert column " + columnIndex + " to long: " + e.toString());
+ throw new SQLException(
+ "Cannot convert column " + columnIndex + " to long: " + e.toString(),
+ e);
}
}
@@ -578,7 +582,7 @@ public abstract class HiveBaseResultSet
throw new Exception("Illegal conversion");
} catch (Exception e) {
throw new SQLException("Cannot convert column " + columnIndex
- + " to short: " + e.toString());
+ + " to short: " + e.toString(), e);
}
}
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=1488740&r1=1488739&r2=1488740&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 Sun Jun 2 16:47:45 2013
@@ -146,7 +146,7 @@ public class HiveConnection implements j
}
} catch (SaslException e) {
throw new SQLException("Could not establish secure connection to "
- + uri + ": " + e.getMessage(), " 08S01");
+ + uri + ": " + e.getMessage(), " 08S01", e);
}
}
@@ -155,9 +155,8 @@ public class HiveConnection implements j
try {
transport.open();
} catch (TTransportException e) {
- e.printStackTrace();
throw new SQLException("Could not establish connection to "
- + uri + ": " + e.getMessage(), " 08S01");
+ + uri + ": " + e.getMessage(), " 08S01", e);
}
}
@@ -178,7 +177,7 @@ public class HiveConnection implements j
sessHandle = openResp.getSessionHandle();
} catch (TException e) {
throw new SQLException("Could not establish connection to "
- + uri + ": " + e.getMessage(), " 08S01");
+ + uri + ": " + e.getMessage(), " 08S01", e);
}
isClosed = false;
}
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=1488740&r1=1488739&r2=1488740&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 Sun Jun 2 16:47:45 2013
@@ -124,7 +124,7 @@ public class HiveDatabaseMetaData implem
try {
catalogResp = client.GetCatalogs(new TGetCatalogsReq(sessHandle));
} catch (TException e) {
- throw new SQLException(e.getMessage(), "08S01");
+ throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(catalogResp.getStatus());
@@ -197,7 +197,7 @@ public class HiveDatabaseMetaData implem
try {
colResp = client.GetColumns(colReq);
} catch (TException e) {
- throw new SQLException(e.getMessage(), "08S01");
+ throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(colResp.getStatus());
// build the resultset from response
@@ -312,7 +312,7 @@ public class HiveDatabaseMetaData implem
try {
funcResp = client.GetFunctions(getFunctionsReq);
} catch (TException e) {
- throw new SQLException(e.getMessage(), "08S01");
+ throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(funcResp.getStatus());
@@ -553,7 +553,7 @@ public class HiveDatabaseMetaData implem
try {
schemaResp = client.GetSchemas(schemaReq);
} catch (TException e) {
- throw new SQLException(e.getMessage(), "08S01");
+ throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(schemaResp.getStatus());
@@ -597,7 +597,7 @@ public class HiveDatabaseMetaData implem
try {
tableTypeResp = client.GetTableTypes(new TGetTableTypesReq(sessHandle));
} catch (TException e) {
- throw new SQLException(e.getMessage(), "08S01");
+ throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(tableTypeResp.getStatus());
@@ -630,7 +630,7 @@ public class HiveDatabaseMetaData implem
try {
getTableResp = client.GetTables(getTableReq);
} catch (TException e) {
- throw new SQLException(e.getMessage(), "08S01");
+ throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(getTableResp.getStatus());
@@ -687,7 +687,7 @@ public class HiveDatabaseMetaData implem
try {
getTypeInfoResp = client.GetTypeInfo(getTypeInfoReq);
} catch (TException e) {
- throw new SQLException(e.getMessage(), "08S01");
+ throw new SQLException(e.getMessage(), "08S01", e);
}
Utils.verifySuccess(getTypeInfoResp.getStatus());
return new HiveQueryResultSet.Builder()
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=1488740&r1=1488739&r2=1488740&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 Sun Jun 2 16:47:45 2013
@@ -108,7 +108,7 @@ public class HiveStatement implements ja
} catch (SQLException e) {
throw e;
} catch (Exception e) {
- throw new SQLException(e.toString(), "08S01");
+ throw new SQLException(e.toString(), "08S01", e);
}
}
@@ -143,7 +143,7 @@ public class HiveStatement implements ja
} catch (SQLException e) {
throw e;
} catch (Exception e) {
- throw new SQLException(e.toString(), "08S01");
+ throw new SQLException(e.toString(), "08S01", e);
}
stmtHandle = null;
}
@@ -184,7 +184,7 @@ public class HiveStatement implements ja
} catch (SQLException eS) {
throw eS;
} catch (Exception ex) {
- throw new SQLException(ex.toString(), "08S01");
+ throw new SQLException(ex.toString(), "08S01", ex);
}
if (!stmtHandle.isHasResultSet()) {
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java?rev=1488740&r1=1488739&r2=1488740&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java Sun Jun 2 16:47:45 2013
@@ -113,7 +113,7 @@ public class Driver implements CommandPr
static final private LogHelper console = new LogHelper(LOG);
private static final Object compileMonitor = new Object();
-
+
private int maxRows = 100;
ByteStream.Output bos = new ByteStream.Output();
@@ -885,10 +885,10 @@ public class Driver implements CommandPr
driverRunHook.preDriverRun(hookContext);
}
} catch (Exception e) {
- errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e);
+ errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e)
+ + "\n" + org.apache.hadoop.util.StringUtils.stringifyException(e);
SQLState = ErrorMsg.findSQLState(e.getMessage());
- console.printError(errorMessage + "\n"
- + org.apache.hadoop.util.StringUtils.stringifyException(e));
+ console.printError(errorMessage);
return new CommandProcessorResponse(12, errorMessage, SQLState);
}
@@ -961,10 +961,10 @@ public class Driver implements CommandPr
driverRunHook.postDriverRun(hookContext);
}
} catch (Exception e) {
- errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e);
+ errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e)
+ + "\n" + org.apache.hadoop.util.StringUtils.stringifyException(e);
SQLState = ErrorMsg.findSQLState(e.getMessage());
- console.printError(errorMessage + "\n"
- + org.apache.hadoop.util.StringUtils.stringifyException(e));
+ console.printError(errorMessage);
return new CommandProcessorResponse(12, errorMessage, SQLState);
}
Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java?rev=1488740&r1=1488739&r2=1488740&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java Sun Jun 2 16:47:45 2013
@@ -79,6 +79,7 @@ public abstract class HiveCommandOperati
sessionState.out = new PrintStream(System.out, true, "UTF-8");
sessionState.err = new PrintStream(System.err, true, "UTF-8");
} catch (UnsupportedEncodingException ee) {
+ LOG.error("Error creating PrintStream", e);
ee.printStackTrace();
sessionState.out = null;
sessionState.err = null;
@@ -117,7 +118,7 @@ public abstract class HiveCommandOperati
}
} catch (Exception e) {
setState(OperationState.ERROR);
- throw new HiveSQLException("Error running query: " + e.toString());
+ throw new HiveSQLException("Error running query: " + e.toString(), e);
}
setState(OperationState.FINISHED);
}
Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java?rev=1488740&r1=1488739&r2=1488740&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java Sun Jun 2 16:47:45 2013
@@ -110,7 +110,7 @@ public class SQLOperation extends Execut
throw e;
} catch (Exception e) {
setState(OperationState.ERROR);
- throw new HiveSQLException("Error running query: " + e.toString());
+ throw new HiveSQLException("Error running query: " + e.toString(), e);
}
setState(OperationState.FINISHED);
}
@@ -208,7 +208,7 @@ public class SQLOperation extends Execut
// for now, expose non-primitive as a string
// TODO: expose non-primitive as a structured object while maintaining JDBC compliance
if (oi.getCategory() != ObjectInspector.Category.PRIMITIVE) {
- return SerDeUtils.getJSONString(o, oi);
+ return SerDeUtils.getJSONString(o, oi);
}
return obj;
}