Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Current code fails below test
// code placeholder @Test public void testUpdateSubQueryWithIn1() { final String sql = "update emp\n" + "set empno = 1 where emp.empno in (\n" + " select emp.empno from emp where emp.empno=2)"; sql(sql).ok(); } java.lang.NullPointerExceptionjava.lang.NullPointerException at org.apache.calcite.rel.logical.LogicalJoin.create(LogicalJoin.java:146) at org.apache.calcite.rel.logical.LogicalJoin.create(LogicalJoin.java:163) at org.apache.calcite.sql2rel.SqlToRelConverter.substituteSubQuery(SqlToRelConverter.java:1130) at org.apache.calcite.sql2rel.SqlToRelConverter.replaceSubQueries(SqlToRelConverter.java:1014) at org.apache.calcite.sql2rel.SqlToRelConverter.convertUpdate(SqlToRelConverter.java:3574) at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3176) at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:563) at org.apache.calcite.test.SqlToRelTestBase$TesterImpl.convertSqlToRel(SqlToRelTestBase.java:616) at org.apache.calcite.test.SqlToRelTestBase$TesterImpl.assertConvertsTo(SqlToRelTestBase.java:731) at org.apache.calcite.test.SqlToRelConverterTest$Sql.convertsTo(SqlToRelConverterTest.java:3601) at org.apache.calcite.test.SqlToRelConverterTest$Sql.ok(SqlToRelConverterTest.java:3593)
In above case, Subquery is used as SqlUpdate#condition, when converting and trying to replace the subquery in SqlUpdate#condition, BalckBoard#root is null and it makes no sense to do the subquery substitution.
Attachments
Issue Links
- links to