[
https://issues.apache.org/jira/browse/IMPALA-8497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Fredy Wijaya resolved IMPALA-8497.
----------------------------------
Resolution: Fixed
Fix Version/s: Impala 3.3.0
> 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
> Fix For: Impala 3.3.0
>
>
> 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]