[
https://issues.apache.org/jira/browse/PHOENIX-7090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
chaijunjie updated PHOENIX-7090:
--------------------------------
Summary: Hash join throw NullPointerException when subquery return null
(was: Hash join throw NullPointerException when use subquery)
> Hash join throw NullPointerException when subquery return null
> --------------------------------------------------------------
>
> Key: PHOENIX-7090
> URL: https://issues.apache.org/jira/browse/PHOENIX-7090
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 5.1.2
> Reporter: chaijunjie
> Assignee: chaijunjie
> Priority: Major
>
> {code:java}
> create table t1 (id varchar not null primary key, v1 varchar, v2 varchar);
> create table t2 (id varchar not null primary key, v3 varchar, v4 varchar);
> upsert into t1 values('1','2','3');
> upsert into t2 values('1','4','5');
> select * from t1 where id = (select id from t2 where v3='x' limit 1);{code}
>
> {code:java}
> 0: jdbc:phoenix:> select * from t1 where id = (select id from t2 where v3='x'
> limit 1);
> Error: Encountered exception in sub plan [0] execution. (state=,code=0)
> java.sql.SQLException: Encountered exception in sub plan [0] execution.
> at org.apache.phoenix.execute.HashJoinPlan.iterator(HashJoinPlan.java:220)
> at
> org.apache.phoenix.execute.DelegateQueryPlan.iterator(DelegateQueryPlan.java:144)
> at
> org.apache.phoenix.execute.DelegateQueryPlan.iterator(DelegateQueryPlan.java:139)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:320)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:299)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:298)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:291)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1994)
> at sqlline.Commands.executeSingleQuery(Commands.java:1054)
> at sqlline.Commands.execute(Commands.java:1003)
> at sqlline.Commands.sql(Commands.java:967)
> at sqlline.SqlLine.dispatch(SqlLine.java:734)
> at sqlline.SqlLine.begin(SqlLine.java:541)
> at sqlline.SqlLine.start(SqlLine.java:267)
> at sqlline.SqlLine.main(SqlLine.java:206)
> Caused by: java.lang.NullPointerException
> at
> java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
> at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
> at
> org.apache.phoenix.compile.StatementContext.setSubqueryResult(StatementContext.java:305)
> at
> org.apache.phoenix.execute.HashJoinPlan$WhereClauseSubPlan.execute(HashJoinPlan.java:467)
> at org.apache.phoenix.execute.HashJoinPlan$1.call(HashJoinPlan.java:188)
> at org.apache.phoenix.execute.HashJoinPlan$1.call(HashJoinPlan.java:184)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> org.apache.phoenix.job.JobManager$InstrumentedJobFutureTask.run(JobManager.java:185)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:750)
> 0: jdbc:phoenix:> select id from t2 where v3='x' limit 1;
> +----+
> | ID |
> +----+
> +----+
> {code}
> {code:java}
> 0: jdbc:phoenix:> select * from t1 where id = (select id from t2 where v3='4'
> limit 1);
> +----+----+----+
> | ID | V1 | V2 |
> +----+----+----+
> | 1 | 2 | 3 |
> +----+----+----+
> 1 row selected (0.082 seconds)
> 0: jdbc:phoenix:> select id from t2 where v3='4' limit 1;
> +----+
> | ID |
> +----+
> | 1 |
> +----+
> {code}
> when the subquery result return null, and use the "=" in sql will lead this..
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)