Jonathan Leech created PHOENIX-3324:
---------------------------------------
Summary: null literals in a union all query cause an NPE
Key: PHOENIX-3324
URL: https://issues.apache.org/jira/browse/PHOENIX-3324
Project: Phoenix
Issue Type: Bug
Affects Versions: 4.7.0
Reporter: Jonathan Leech
example: select column_name, column_def from system.catalog where column_name
is not null union all select table_name, null from system.catalog where
column_name is null;
throws
java.lang.NullPointerException
at
org.apache.phoenix.schema.ValueSchema$Field.<init>(ValueSchema.java:198)
at
org.apache.phoenix.schema.ValueSchema$Field.<init>(ValueSchema.java:156)
at
org.apache.phoenix.schema.ValueSchema$ValueSchemaBuilder.addField(ValueSchema.java:318)
at
org.apache.phoenix.schema.KeyValueSchema$KeyValueSchemaBuilder.addField(KeyValueSchema.java:70)
at
org.apache.phoenix.execute.TupleProjector.<init>(TupleProjector.java:70)
at
org.apache.phoenix.compile.QueryCompiler.compileUnionAll(QueryCompiler.java:174)
at
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:156)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:399)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:373)
at
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:266)
at
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:261)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:260)
at
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1349)
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)
workaround: wrap null in cast to the appropriate type; e.g. cast(null as
varchar)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)