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)