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

RelMdAllPredicates fast bail out creates mismatch with RelMdTableReferences

    Details

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

      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

            Activity

              People

              • Assignee:
                jcamachorodriguez Jesus Camacho Rodriguez
                Reporter:
                jcamachorodriguez Jesus Camacho Rodriguez
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: