Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-32320

Same correlate can not be reused due to the different correlationId

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Table SQL / Planner
    • None

    Description

      As describe in SubplanReuserTest

        @Test
        def testSubplanReuseOnCorrelate(): Unit = {
          util.addFunction("str_split", new StringSplit())
          val sqlQuery =
            """
              |WITH r AS (SELECT a, b, c, v FROM x, LATERAL TABLE(str_split(c, '-')) AS T(v))
              |SELECT * FROM r r1, r r2 WHERE r1.v = r2.v
            """.stripMargin
          // TODO the sub-plan of Correlate should be reused,
          // however the digests of Correlates are different
          util.verifyExecPlan(sqlQuery)
        }
      

      This will produce the plan

      HashJoin(joinType=[InnerJoin], where=[(f0 = f00)], select=[a, b, c, f0, a0, b0, c0, f00], build=[right])
      :- Exchange(distribution=[hash[f0]])
      :  +- Correlate(invocation=[str_split($cor0.c, _UTF-16LE'-')], correlate=[table(str_split($cor0.c,'-'))], select=[a,b,c,f0], rowType=[RecordType(INTEGER a, BIGINT b, VARCHAR(2147483647) c, VARCHAR(2147483647) f0)], joinType=[INNER])
      :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, x, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
      +- Exchange(distribution=[hash[f0]])
         +- Correlate(invocation=[str_split($cor1.c, _UTF-16LE'-')], correlate=[table(str_split($cor1.c,'-'))], select=[a,b,c,f0], rowType=[RecordType(INTEGER a, BIGINT b, VARCHAR(2147483647) c, VARCHAR(2147483647) f0)], joinType=[INNER])
            +- LegacyTableSourceScan(table=[[default_catalog, default_database, x, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
      

      The Correlate node can not be reused due to the different correlation id.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aitozi WenJun Min
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: