diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java index 46f1ec040a..85c8869683 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java @@ -141,7 +141,9 @@ public ASTNode parse(String command, Context ctx, String viewFullyQualifiedName) try { r = parser.statement(); } catch (RecognitionException e) { - throw new ParseException(parser.errors); + ParseException parseException = new ParseException(parser.errors); + parseException.initCause(e); + throw parseException; } if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) { @@ -171,7 +173,9 @@ public ASTNode parseHint(String command) throws ParseException { try { r = parser.hint(); } catch (RecognitionException e) { - throw new ParseException(parser.errors); + ParseException parseException = new ParseException(parser.errors); + parseException.initCause(e); + throw parseException; } if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) { @@ -211,7 +215,9 @@ public ASTNode parseSelect(String command, Context ctx) throws ParseException { try { r = parser.selectClause(); } catch (RecognitionException e) { - throw new ParseException(parser.errors); + ParseException parseException = new ParseException(parser.errors); + parseException.initCause(e); + throw parseException; } if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) { @@ -235,7 +241,9 @@ public ASTNode parseExpression(String command) throws ParseException { try { r = parser.expression(); } catch (RecognitionException e) { - throw new ParseException(parser.errors); + ParseException parseException = new ParseException(parser.errors); + parseException.initCause(e); + throw parseException; } if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) { @@ -258,7 +266,9 @@ public ASTNode parseTriggerExpression(String command) throws ParseException { try { r = parser.triggerExpressionStandalone(); } catch (RecognitionException e) { - throw new ParseException(parser.errors); + ParseException parseException = new ParseException(parser.errors); + parseException.initCause(e); + throw parseException; } if (lexer.getErrors().size() != 0) { throw new ParseException(lexer.getErrors()); @@ -278,7 +288,9 @@ public ASTNode parseTriggerActionExpression(String command) throws ParseExceptio try { r = parser.triggerActionExpressionStandalone(); } catch (RecognitionException e) { - throw new ParseException(parser.errors); + ParseException parseException = new ParseException(parser.errors); + parseException.initCause(e); + throw parseException; } if (lexer.getErrors().size() != 0) { throw new ParseException(lexer.getErrors());