[
https://issues.apache.org/jira/browse/IMPALA-8497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16842805#comment-16842805
]
ASF subversion and git services commented on IMPALA-8497:
---------------------------------------------------------
Commit 4767d9263782d132ca1eeef8fea7761dc746354f in impala's branch
refs/heads/master from wangsheng
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=4767d92 ]
IMPALA-8497: Fix ArrayIndexOutOfBoundsException for queries that
end with '\n'
When query ends with '\n', impala would throw
ArrayIndexOutOfBoundsException, instead of a syntax error.
The bug only affects the queries submitted directly to
Impala outside Impala shell.
Tests:
* Added test cases in ParserTest.java
* Ran all front-end tests
Change-Id: I3f034b351d0468a77773f6482e27ddef818b34d8
Reviewed-on: http://gerrit.cloudera.org:8080/13293
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> SQL return ArrayIndexOutOfBoundsException when ends with '\n'
> -------------------------------------------------------------
>
> Key: IMPALA-8497
> URL: https://issues.apache.org/jira/browse/IMPALA-8497
> Project: IMPALA
> Issue Type: Bug
> Components: Frontend
> Affects Versions: Impala 3.2.0
> Reporter: WangSheng
> Assignee: WangSheng
> Priority: Minor
>
> When submit sql with jdbc in code, those sqls return
> "ArrayIndexOutOfBoundsException" instead of "Syntax error":
> {code:java}
> show\n
> select\n
> {code}
> This is mainly caused by code below:
> {code:java}
> //sql-parser.cup
> public String getErrorMsg(String stmt) {
> if (errorToken_ == null || stmt == null) return null;
> String[] lines = stmt.split("\n");
> StringBuffer result = new StringBuffer();
> result.append(getErrorTypeMessage(errorToken_.sym) + " in line ");
> result.append(errorToken_.left);
> result.append(":\n");
> // errorToken_.left is the line number of error.
> // errorToken_.right is the column number of the error.
> String errorLine = lines[errorToken_.left - 1];
> //......
> {code}
> because these sqls are ends with '\n', the length of 'lines' array is small
> than 'errorToken_.left - 1', and thus throw ArrayIndexOutOfBoundsException,
> and this exception cannot be catched.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]