Hongtao Zhang created FLINK-11381:
------------------------------------- Summary: JOIN LATERAL with a table was not support Key: FLINK-11381 URL: https://issues.apache.org/jira/browse/FLINK-11381 Project: Flink Issue Type: Improvement Components: Table API & SQL Affects Versions: 1.7.0 Environment: Flink 1.7.0 Reporter: Hongtao Zhang INNER/LEFT LATERAL with a table (not table function) was not support by flink the sql query was tested on postgres 9.5 and passed but failed on Flink val sqlQuery = """ |SELECT | SUM(o.amount * r1.rate) |FROM Orders as o INNER JOIN LATERAL ( | SELECT rowtime, rate | FROM RatesHistory as r | WHERE r.currency = o.currency | AND rowtime <= o.rowtime | ORDER BY rowtime DESC | LIMIT 1 |) as r1 ON TRUE """.stripMargin and the Error below org.apache.flink.table.api.TableException: Cannot generate a valid execution plan for the given query: FlinkLogicalAggregate(group=[{}], EXPR$0=[SUM($0)]) FlinkLogicalCalc(expr#0..5=[\{inputs}], expr#6=[*($t1, $t3)], $f0=[$t6]) FlinkLogicalJoin(condition=[AND(=($0, $4), =($2, $5))], joinType=[inner]) FlinkLogicalNativeTableScan(table=[[_DataStreamTable_0]]) FlinkLogicalCalc(expr#0..4=[\{inputs}], rate=[$t2], rowtime0=[$t3], currency0=[$t4]) FlinkLogicalSort(sort0=[$0], dir0=[DESC], fetch=[1]) FlinkLogicalJoin(condition=[AND(=($1, $4), <=($0, $3))], joinType=[inner]) FlinkLogicalNativeTableScan(table=[[_DataStreamTable_1]]) FlinkLogicalAggregate(group=[\{0, 1}]) FlinkLogicalCalc(expr#0..2=[\{inputs}], rowtime=[$t0], currency=[$t2]) FlinkLogicalNativeTableScan(table=[[_DataStreamTable_0]]) This exception indicates that the query uses an unsupported SQL feature. Please check the documentation for the set of currently supported SQL features. at org.apache.flink.table.api.TableEnvironment.runVolcanoPlanner(TableEnvironment.scala:377) at org.apache.flink.table.api.TableEnvironment.optimizePhysicalPlan(TableEnvironment.scala:302) at org.apache.flink.table.api.StreamTableEnvironment.optimize(StreamTableEnvironment.scala:832) at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:881) at org.apache.flink.table.api.scala.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:170) at org.apache.flink.table.api.scala.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:146) at org.apache.flink.table.api.scala.TableConversions.toAppendStream(TableConversions.scala:98) at org.apache.flink.table.runtime.stream.sql.TemporalJoinITCase.testLateralJoin(TemporalJoinITCase.scala:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) -- This message was sent by Atlassian JIRA (v7.6.3#76005) |
Free forum by Nabble | Edit this page |