Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Decorrelator gets field offsets confused if fields have been trimmed. The query
select empno from "scott".emp as e join "scott".dept as d using (deptno) where e.sal in ( select e2.sal from "scott".emp as e2 where e2.deptno > e.deptno);
gives the stack
Caused by: java.lang.NullPointerException at org.apache.calcite.sql2rel.RelDecorrelator.createValueGenerator(RelDecorrelator.java:746) at org.apache.calcite.sql2rel.RelDecorrelator.decorrelateInputWithValueGenerator(RelDecorrelator.java:856) at org.apache.calcite.sql2rel.RelDecorrelator.decorrelateRel(RelDecorrelator.java:915) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.apache.calcite.util.ReflectUtil.invokeVisitorInternal(ReflectUtil.java:256) at org.apache.calcite.util.ReflectUtil.invokeVisitor(ReflectUtil.java:213) at org.apache.calcite.util.ReflectUtil$1.invokeVisitor(ReflectUtil.java:476) at org.apache.calcite.sql2rel.RelDecorrelator$DecorrelateRelVisitor.visit(RelDecorrelator.java:1434)
The workaround is to disable trimming in SqlToRelConverter and do it only after sub-queries have been expanded and de-correlated. Search for references to this bug number introduced in the fix to CALCITE-816.
Attachments
Issue Links
- is related to
-
CALCITE-816 Represent sub-query as a RexNode
- Closed
- relates to
-
CALCITE-864 Correlation variable has incorrect row type if it is populated by right side of a Join
- Closed