diff options
author | Jinfeng Ni <jni@maprtech.com> | 2014-03-26 16:14:59 -0700 |
---|---|---|
committer | Timothy Chen <tnachen@apache.org> | 2014-03-27 12:57:31 -0700 |
commit | f632921489e3099ba898c6fb2e9019b0d3aea8f4 (patch) | |
tree | d6052f639ad4bed03f9f5af554707cfc08d0c7c6 /common | |
parent | 7658f55ae0b889a4f8bc1c1fc9fb44dd7032330e (diff) |
Drill-449: Catch parsing error thrown by Antlr parser, when expression has error, and stop the execution immediately.
DRILL-449: minor change to test case.
Diffstat (limited to 'common')
-rw-r--r-- | common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g b/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g index edb850740..b60e2d68d 100644 --- a/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g +++ b/common/src/main/antlr3/org/apache/drill/common/expression/parser/ExprParser.g @@ -37,7 +37,7 @@ import java.util.*; import org.apache.drill.common.expression.*; import org.apache.drill.common.types.*; import org.apache.drill.common.types.TypeProtos.*; - +import org.apache.drill.common.exceptions.ExpressionParsingException; } @members{ @@ -51,6 +51,13 @@ import org.apache.drill.common.types.TypeProtos.*; public ExpressionPosition pos(Token token){ return new ExpressionPosition(fullExpression, token.getTokenIndex()); } + + @Override + public void displayRecognitionError(String[] tokenNames, RecognitionException e) { + String hdr = getErrorHeader(e); + String msg = getErrorMessage(e, tokenNames); + throw new ExpressionParsingException("Expression has syntax error! " + hdr + ":" + msg); + } } parse returns [LogicalExpression e] |