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

join lateral table function with condition fails with exception

    XMLWordPrintableJSON

Details

    Description

      Reproducing:

       

      // CorrelateITCase.scala
      @Test
      def testJoinTableFunction(): Unit = {
        registerFunction("func", new TableFunc2)
        val sql =
          """
            | select
            |   c, s, l
            | from inputT JOIN LATERAL TABLE(func(c)) as T(s, l)
            | on s = c
            |""".stripMargin
        checkResult(sql, Seq())
      }
      

      The it case will be failed with exception: "Cannot generate a valid execution plan for the given query".

       Firstly, for the given sql, the logical plan produced after decorrelating is already wrong, which is a  bug introduced by CALCITE-2004, and fixed in CALCITE-3847 (fixed versions 1.23).

      Secondly, even after the fix, we may fail in `FlinkCorrelateVariablesValidationProgram`, because after decorrelating, there exists correlate variable in a `LogicalFilter`. we should fix the validation problem.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              icshuo Shuo Cheng
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: