[ 
https://issues.apache.org/jira/browse/CALCITE-4019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17120685#comment-17120685
 ] 

Wang Yanlin edited comment on CALCITE-4019 at 6/1/20, 1:34 AM:
---------------------------------------------------------------

Sorry about that, my bad.

Should I reopen this jira and make another PR to fix it or should I create 
another jira?


was (Author: yanlin-lynn):
Sorry about that, my bad.

How about I reopen this jira and make another PR to fix it?

> Visit SqlInsert with SqlShuttle cause NullPointerException
> ----------------------------------------------------------
>
>                 Key: CALCITE-4019
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4019
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Wang Yanlin
>            Priority: Major
>             Fix For: 1.24.0
>
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> When visit a SqlInsert with SqlShuttle, got NPE, the stack trace is
> {noformat}
> java.lang.NullPointerException
>       at com.google.common.collect.Iterators$8.transform(Iterators.java:817)
>       at 
> com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
>       at org.apache.calcite.sql.parser.SqlParserPos.sum(SqlParserPos.java:274)
>       at 
> org.apache.calcite.sql.parser.SqlParserPos.plusAll(SqlParserPos.java:183)
>       at org.apache.calcite.sql.SqlOperator.createCall(SqlOperator.java:251)
>       at 
> org.apache.calcite.sql.util.SqlShuttle$CallCopyingArgHandler.result(SqlShuttle.java:117)
>       at 
> org.apache.calcite.sql.util.SqlShuttle$CallCopyingArgHandler.result(SqlShuttle.java:101)
>       at org.apache.calcite.sql.util.SqlShuttle.visit(SqlShuttle.java:67)
>       at org.apache.calcite.sql.util.SqlShuttle.visit(SqlShuttle.java:39)
>       at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139)
>       at 
> org.apache.calcite.sql.parser.SqlParserTest.testSqlParserPosPlus(SqlParserTest.java:8791)
> {noformat}
> Add this case in SqlParserTest to reproduce.
>  return a new same SqlIdentifier for each SqlIdentifier, make sure 
> [update|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/util/SqlShuttle.java#L117]
>  
>  happends
> {noformat}
> @Test void testSqlParserPosPlus() throws Exception {
>     final String sql = "insert into emps select * from emps";
>     SqlNode sqlNode = getSqlParser(sql).parseStmt();
>     sqlNode.accept(new SqlShuttle(){
>       @Override
>       public SqlNode visit(SqlIdentifier identifier) {
>         return new SqlIdentifier(identifier.names, 
> identifier.getParserPosition());
>       }
>     });
>   }
> {noformat}



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

Reply via email to