[jira] [Created] (FLINK-16578) join lateral table function with condition fails with exception

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-16578) join lateral table function with condition fails with exception

Shang Yuanchun (Jira)
Shuo Cheng created FLINK-16578:
----------------------------------

             Summary: join lateral table function with condition fails with exception
                 Key: FLINK-16578
                 URL: https://issues.apache.org/jira/browse/FLINK-16578
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 1.10.0
            Reporter: Shuo Cheng


Reproducing:

 
{code:java}
// 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())
}
{code}
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 by SqlToRelConvert 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)