You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Heather (JIRA)" <ji...@apache.org> on 2015/09/09 12:44:45 UTC

[jira] [Created] (PHOENIX-2241) NPE in UPSERT SELECT in sqlline when there are extraneous parentheses

James Heather created PHOENIX-2241:
--------------------------------------

             Summary: NPE in UPSERT SELECT in sqlline when there are extraneous parentheses
                 Key: PHOENIX-2241
                 URL: https://issues.apache.org/jira/browse/PHOENIX-2241
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.3.0
         Environment: CDH5
            Reporter: James Heather
            Priority: Minor


I tried to add some new rows into a table using an {{upsert select}}. The rows I was adding weren't in fact based on the existing rows, but I needed the {{select}} to come from somewhere.

I put extra parentheses in by mistake, and got a NPE:

{code}
0: jdbc:phoenix:172.31.31.143> upsert into linktab (id, first_val, second_val) select (next value for linktab_next_id, round(rand()*1000000000000), round(rand()*1000000000000)) from linktab;
java.lang.NullPointerException
	at org.apache.phoenix.compile.SequenceValueExpression.evaluate(SequenceValueExpression.java:49)
	at org.apache.phoenix.expression.RowValueConstructorExpression.evaluate(RowValueConstructorExpression.java:140)
	at org.apache.phoenix.expression.RowValueConstructorExpression.init(RowValueConstructorExpression.java:99)
	at org.apache.phoenix.expression.RowValueConstructorExpression.<init>(RowValueConstructorExpression.java:57)
	at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:1180)
	at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:134)
	at org.apache.phoenix.parse.RowValueConstructorParseNode.accept(RowValueConstructorParseNode.java:45)
	at org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:370)
	at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:490)
	at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:447)
	at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:154)
	at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:423)
	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:487)
	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:478)
	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:279)
	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:272)
	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:271)
	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1063)
	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)
0: jdbc:phoenix:172.31.31.143>
{code}

Note that the {{select}} part is of the form {{select (a, b, c) from...}} rather than {{select a, b, c from...}}.

Removing the extra parentheses made the query complete fine, but it still shouldn't throw a NPE.



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