Jingnan Si created PHOENIX-2662:
-----------------------------------

             Summary: get nullpointer exception when do upsert select with not 
exists in table
                 Key: PHOENIX-2662
                 URL: https://issues.apache.org/jira/browse/PHOENIX-2662
             Project: Phoenix
          Issue Type: Bug
            Reporter: Jingnan Si


based on my understanding, the upsert statement should insert a new row since 
the subquery should return non row, but it fails in nullpointexception

0: jdbc:phoenix:localhost> create table tt(aa integer, constraint aa_key 
primary key(aa));
No rows affected (0.274 seconds)
0: jdbc:phoenix:localhost> upsert into tt select 2 from tt where not exists 
(select 1 from tt where aa=2);
java.lang.NullPointerException
        at 
org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:1308)
        at 
org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:141)
        at 
org.apache.phoenix.parse.ExistsParseNode.accept(ExistsParseNode.java:53)
        at 
org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:130)
        at 
org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:100)
        at 
org.apache.phoenix.execute.HashJoinPlan.iterator(HashJoinPlan.java:192)
        at 
org.apache.phoenix.execute.HashJoinPlan.iterator(HashJoinPlan.java:123)
        at 
org.apache.phoenix.compile.UpsertCompiler$2.execute(UpsertCompiler.java:736)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:319)
        at 
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:311)
        at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:309)
        at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1379)
        at sqlline.Commands.execute(Commands.java:822)
        at sqlline.Commands.sql(Commands.java:732)
        at sqlline.SqlLine.dispatch(SqlLine.java:808)
        at sqlline.SqlLine.begin(SqlLine.java:681)
        at sqlline.SqlLine.start(SqlLine.java:398)
        at sqlline.SqlLine.main(SqlLine.java:292)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to