Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.21.0
Description
SQL:
select ^ from (select * from sales.emp ) a
use SqlSimpleParser parse sql
Exception:
java.lang.NullPointerExceptionjava.lang.NullPointerException at org.apache.calcite.sql.advise.SqlSimpleParser$Query.contains(SqlSimpleParser.java:818) at org.apache.calcite.sql.advise.SqlSimpleParser$Query.simplify(SqlSimpleParser.java:548) at org.apache.calcite.sql.advise.SqlSimpleParser$Query.simplifyList(SqlSimpleParser.java:508) at org.apache.calcite.sql.advise.SqlSimpleParser.simplifySql(SqlSimpleParser.java:171) at org.apache.calcite.sql.advise.SqlSimpleParser.simplifySql(SqlSimpleParser.java:141) at org.apache.calcite.sql.advise.SqlAdvisor.simplifySql(SqlAdvisor.java:556) at org.apache.calcite.sql.advise.SqlAdvisor.getCompletionHints0(SqlAdvisor.java:222) at org.apache.calcite.sql.advise.SqlAdvisor.getCompletionHints(SqlAdvisor.java:192)
cause:
SqlSimpleParser Token.s
s is null
private boolean contains(String hintToken) { for (Token token : tokenList) { switch (token.type) { case ID: // exception if (token.s.equals(hintToken)) { return true; } break; case QUERY: if (((Query) token).contains(hintToken)) { return true; } break; } } return false; }
Attachments
Issue Links
- links to