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

AssertionError while translating query with WITH and correlated sub-query

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.12.0
    • Component/s: None
    • Labels:

      Description

      If a query has a WITH clause with column aliases, and also a correlated sub-query, Optiq gives an AssertionError while trying to translate a field name.

      with t (a, b) as (select * from (values (1, 2)))
      select * from t where exists (select 1 from emp where deptno = t.a);
      
      Caused by: java.lang.AssertionError: Internal error: Type 'RecordType(INTEGER A, INTEGER B)' has no field 'EXPR$0'
      	at org.eigenbase.util.Util.newInternal(Util.java:734)
      	at org.eigenbase.rex.RexBuilder.makeFieldAccess(RexBuilder.java:133)
      	at org.eigenbase.sql2rel.SqlToRelConverter.convertIdentifier(SqlToRelConverter.java:3223)
      

        Activity

        Hide
        julianhyde Julian Hyde added a comment -

        I just checked this. Still exists as of CALCITE-1494. There are test cases (disabled) in misc.iq and sub-query.iq.

        Show
        julianhyde Julian Hyde added a comment - I just checked this. Still exists as of CALCITE-1494 . There are test cases (disabled) in misc.iq and sub-query.iq.
        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/57b38db5 .
        Hide
        julianhyde Julian Hyde added a comment -

        Resolved in release 1.12.0 (2017-03-24).

        Show
        julianhyde Julian Hyde added a comment - Resolved in release 1.12.0 (2017-03-24).

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development