You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Haisheng Yuan (Jira)" <ji...@apache.org> on 2019/11/09 19:13:00 UTC

[jira] [Resolved] (CALCITE-3474) SqlSimpleParser toke.s equals NullPointerException

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

Haisheng Yuan resolved CALCITE-3474.
------------------------------------
    Resolution: Fixed

Fixed in https://github.com/apache/calcite/commit/4d1c3e54fc4172c7ff00db3326823c42f237cf04, thanks for the PR, [~quxiucheng]!

> SqlSimpleParser toke.s equals NullPointerException
> --------------------------------------------------
>
>                 Key: CALCITE-3474
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3474
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.21.0
>            Reporter: quxiucheng
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.22.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
>  
>  
> SQL:
>  
> {code:java}
> select ^ from (select * from sales.emp ) a
> {code}
> use SqlSimpleParser parse sql
> Exception:
>  
>  
>  
> {code:java}
> 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)
> {code}
>  
>  
> cause:
> SqlSimpleParser Token.s
> s is null
> {code:java}
> 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;
> }
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)