jinxing64 commented on a change in pull request #1413: [CALCITE-3292]
SqlToRelConverter#substituteSubQuery fails with NullPo…
URL: https://github.com/apache/calcite/pull/1413#discussion_r317572469
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
##########
@@ -1102,6 +1102,16 @@ private void substituteSubQuery(Blackboard bb, SubQuery
subQuery) {
// where emp.deptno <> null
// and q.indicator <> TRUE"
//
+ // Note:
+ // Subquery can be used as SqlUpdate#condition like below:
+ // "update emp
+ // set empno = 1 where emp.empno in (
+ // select emp.empno from emp where emp.empno=2)"
+ // In such case, when converting SqlUpdate#condition, bb.root is null
+ // and it makes no sense to do the subquery substituion.
+ if (bb.root == null) {
+ return;
+ }
Review comment:
Thanks @chunweilei
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services