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

Traits Propagation for EnumerableMergeJoin Produces Incorrect Result

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.24.0
    • None
    • None

    Description

      In EnumerableMergeJoin's deriveTraits method, it uses a Map to record mapping from left keys to right keys (the keyMap variable). However, the left keys could have duplicate entries.
      One example is JdbcTest.testJoinInCorrelatedSubQuery, the expected plan is

      EnumerableProject(deptno=[$0], name=[$1], employees=[$2], location=[$3])
        EnumerableMergeJoin(condition=[AND(=($0, $5), =($0, $4))], joinType=[inner])
          EnumerableSort(sort0=[$0], dir0=[ASC])
            EnumerableTableScan(table=[[hr, depts]])
          EnumerableSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])
            ...

      where left keys are [0, 0] , and right keys are [1, 0]. Deriving right child's traits may result in incorrect output.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              FatLittle Jinpeng Wu
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: