Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-842

Decorrelator gets field offsets confused if fields have been trimmed

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6.0
    • Component/s: None
    • Labels:
      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.

        Issue Links

          Activity

          Show
          julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/4b519b98 .
          Hide
          julianhyde Julian Hyde added a comment -

          Resolved in release 1.6.0 (2016-01-22).

          Show
          julianhyde Julian Hyde added a comment - Resolved in release 1.6.0 (2016-01-22).

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              julianhyde Julian Hyde
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development