Jesus Camacho Rodriguez created CALCITE-2189:
------------------------------------------------

             Summary: RelMdAllPredicates fast bail out creates mismatch with 
RelMdTableReferences
                 Key: CALCITE-2189
                 URL: https://issues.apache.org/jira/browse/CALCITE-2189
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Jesus Camacho Rodriguez
            Assignee: Jesus Camacho Rodriguez
             Fix For: 1.16.0


The idea behind the metadata providers introduced in CALCITE-1682 is that we 
can identify the lineage of the expressions. If we bypass assigning a unique 
identifier for the table in RelMdAllPredicates because there are no predicates 
on those tables, then we will end up referencing wrong tables.

E.g.
{code}
select x.sal from
(select a.deptno, c.sal from (select * from emp limit 7) as a
cross join (select * from dept limit 1) as b
cross join (select * from emp where empno = 5 limit 2) as c) as x;
{code}
Table refs: {{[[CATALOG, SALES, DEPT].#0, [CATALOG, SALES, EMP].#0, [CATALOG, 
SALES, EMP].#1]}}
Extracted predicate without fix (wrong): {{=([CATALOG, SALES, EMP].#0.$0, 5)}}
Extracted predicate with fix (correct): {{=([CATALOG, SALES, EMP].#1.$0, 5)}}






--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to