[
https://issues.apache.org/jira/browse/IMPALA-8497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16838026#comment-16838026
]
WangSheng commented on IMPALA-8497:
-----------------------------------
Hi [~tarmstrong], I've already solved this probelm, and I tested this function,
here is the gerrit url:
https://gerrit.cloudera.org/#/c/13293/
> 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]