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

RelMdAllPredicates fast bail out creates mismatch with RelMdTableReferences

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.16.0
    • core
    • 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

              jcamacho Jesús Camacho Rodríguez
              jcamacho Jesús Camacho Rodríguez
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: