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)
      

        Attachments

          Activity

            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: