[ 
https://issues.apache.org/jira/browse/IMPALA-8497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim Armstrong reassigned IMPALA-8497:
-------------------------------------

    Assignee: WangSheng

> 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: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to