Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-28064: Add cause to ParseException for diagnosability purposes #5067

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions parser/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java
Expand Up @@ -122,7 +122,7 @@ public ParseResult parse(String command, Configuration configuration)
try {
r = parser.statement();
} catch (RecognitionException e) {
throw new ParseException(parser.errors);
throw new ParseException(parser.errors, e);
}

if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) {
Expand Down Expand Up @@ -152,7 +152,7 @@ public ASTNode parseHint(String command) throws ParseException {
try {
r = parser.hint();
} catch (RecognitionException e) {
throw new ParseException(parser.errors);
throw new ParseException(parser.errors, e);
}

if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) {
Expand Down Expand Up @@ -191,7 +191,7 @@ public ParseResult parseSelect(String command, Configuration configuration) thro
try {
r = parser.selectClause();
} catch (RecognitionException e) {
throw new ParseException(parser.errors);
throw new ParseException(parser.errors, e);
}

if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) {
Expand All @@ -215,7 +215,7 @@ public ASTNode parseExpression(String command) throws ParseException {
try {
r = parser.expression();
} catch (RecognitionException e) {
throw new ParseException(parser.errors);
throw new ParseException(parser.errors, e);
}

if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) {
Expand All @@ -238,7 +238,7 @@ public ASTNode parseTriggerExpression(String command) throws ParseException {
try {
r = parser.triggerExpressionStandalone();
} catch (RecognitionException e) {
throw new ParseException(parser.errors);
throw new ParseException(parser.errors, e);
}
if (lexer.getErrors().size() != 0) {
throw new ParseException(lexer.getErrors());
Expand All @@ -258,7 +258,7 @@ public ASTNode parseTriggerActionExpression(String command) throws ParseExceptio
try {
r = parser.triggerActionExpressionStandalone();
} catch (RecognitionException e) {
throw new ParseException(parser.errors);
throw new ParseException(parser.errors, e);
}
if (lexer.getErrors().size() != 0) {
throw new ParseException(lexer.getErrors());
Expand Down
Expand Up @@ -18,22 +18,25 @@

package org.apache.hadoop.hive.ql.parse;

import java.util.ArrayList;

/**
* ParseException.
*
*/
public class ParseException extends Exception {

private static final long serialVersionUID = 1L;
ArrayList<ParseError> errors;
private final Iterable<ParseError> errors;

public ParseException(ArrayList<ParseError> errors) {
public ParseException(Iterable<ParseError> errors) {
super();
this.errors = errors;
}

public ParseException(Iterable<ParseError> errors, Throwable cause) {
super(cause);
this.errors = errors;
}

@Override
public String getMessage() {

Expand Down