Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
Impala 3.2.0
-
None
-
ghx-label-6
Description
When submit sql with jdbc in code, those sqls return "ArrayIndexOutOfBoundsException" instead of "Syntax error":
show\n select\n
This is mainly caused by code below:
//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]; //......
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.