Description
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.
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;
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)
Attachments
Issue Links
- relates to
-
CALCITE-1682 New metadata providers for expression column origin and all predicates in plan
- Closed