Description
During our tests, encountered NPE when there is no data in the table.
MainThread|2/2 SELECT * FROM (SELECT ID, BIG_ID, DATE_ID FROM LARGE_TABLE AS A WHERE (A.ID % 5) = 0) AS A INNER JOIN (SELECT SEC_ID, SEC_TINY_ID, SEC_UNSIG_FLOAT_ID FROM SECONDARY_LARGE_TABLE AS B WHERE (B.SEC_ID % 5) = 0) AS B ON A.ID=B.SEC_ID WHERE A.DATE_ID > ALL (SELECT SEC_DATE_ID FROM SECONDARY_LARGE_TABLE LIMIT 100) AND B.SEC_UNSIG_FLOAT_ID = ANY (SELECT sec_unsig_float_id FROM SECONDARY_LARGE_TABLE WHERE SEC_ID > ALL (SELECT MIN (ID) FROM GRAMMAR_TABLE WHERE UNSIG_ID IS NULL) AND SEC_UNSIG_ID < ANY (SELECT DISTINCT(UNSIG_ID) FROM LARGE_TABLE WHERE UNSIG_ID<2500) LIMIT 1000) AND A.ID < 10000;
MainThread|[1;31mError: Encountered exception in sub plan [0] execution. (state=,code=0)[m
MainThread|java.sql.SQLException: Encountered exception in sub plan [0] execution.
MainThread|at org.apache.phoenix.execute.HashJoinPlan.iterator(HashJoinPlan.java:156)
MainThread|at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:245)
MainThread|at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:235)
MainThread|at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
MainThread|at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:234)
MainThread|at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1158)
MainThread|at sqlline.Commands.execute(Commands.java:822)
MainThread|at sqlline.Commands.sql(Commands.java:732)
MainThread|at sqlline.SqlLine.dispatch(SqlLine.java:808)
MainThread|at sqlline.SqlLine.runCommands(SqlLine.java:1711)
MainThread|at sqlline.Commands.run(Commands.java:1285)
MainThread|at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
MainThread|at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
MainThread|at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
MainThread|at java.lang.reflect.Method.invoke(Method.java:606)
MainThread|at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)
MainThread|at sqlline.SqlLine.dispatch(SqlLine.java:804)
MainThread|at sqlline.SqlLine.initArgs(SqlLine.java:613)
MainThread|at sqlline.SqlLine.begin(SqlLine.java:656)
MainThread|at sqlline.SqlLine.start(SqlLine.java:398)
MainThread|at sqlline.SqlLine.main(SqlLine.java:292)
MainThread|Caused by: java.lang.NullPointerException
MainThread|at org.apache.phoenix.schema.types.PDataType.instantiatePhoenixArray(PDataType.java:1119)
MainThread|at org.apache.phoenix.schema.types.PArrayDataType.instantiatePhoenixArray(PArrayDataType.java:614)
MainThread|at org.apache.phoenix.execute.HashJoinPlan$WhereClauseSubPlan.execute(HashJoinPlan.java:283)
MainThread|at org.apache.phoenix.execute.HashJoinPlan$1.call(HashJoinPlan.java:135)
MainThread|at java.util.concurrent.FutureTask.run(FutureTask.java:262)
MainThread|at org.apache.phoenix.job.JobManager$InstrumentedJobFutureTask.run(JobManager.java:172)
MainThread|at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
MainThread|at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
MainThread|at java.lang.Thread.run(Thread.java:745)
MainThread|[1;31mAborting command set because "force" is false and command failed: "SELECT * FROM (SELECT ID, BIG_ID, DATE_ID FROM LARGE_TABLE AS A WHERE (A.ID % 5) = 0) AS A INNER JOIN (SELECT SEC_ID, SEC_TINY_ID, SEC_UNSIG_FLOAT_ID FROM SECONDARY_LARGE_TABLE AS B WHERE (B.SEC_ID % 5) = 0) AS B ON A.ID=B.SEC_ID WHERE A.DATE_ID > ALL (SELECT SEC_DATE_ID FROM SECONDARY_LARGE_TABLE LIMIT 100) AND B.SEC_UNSIG_FLOAT_ID = ANY (SELECT sec_unsig_float_id FROM SECONDARY_LARGE_TABLE WHERE SEC_ID > ALL (SELECT MIN (ID) FROM GRAMMAR_TABLE WHERE UNSIG_ID IS NULL) AND SEC_UNSIG_ID < ANY (SELECT DISTINCT(UNSIG_ID) FROM LARGE_TABLE WHERE UNSIG_ID<2500) LIMIT 1000) AND A.ID < 10000;"[m
MainThread|Closing: org.apache.phoenix.jdbc.PhoenixConnection