temporal table join SQL报错

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

temporal table join SQL报错

Lucas
我在使用flink 1.12.0,在按博客里的例子实现temporal table join
https://flink.apache.org/news/2020/12/10/release-1.12.0.html#table-apisql-support-for-temporal-table-joins-in-sql 

构造了类似的表格后,写了类似SQL
-- Event-time temporal table join
SELECT
    o.order_id,
    o.order_time,
    o.amount * r.currency_rate AS amount,
    r.currency
FROM orders AS o, latest_rates FOR SYSTEM_TIME AS OF o.order_time r
ON o.currency = r.currency;
上传到flink后,提示
py4j.protocol.Py4JJavaError: An error occurred while calling o2.sqlQuery.
: org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "ON" at line 8, column 5.
Was expecting one of:
    <EOF>
    "EXCEPT" ...
    "FETCH" ...
    "GROUP" ...

在把最后一行的ON改为WHERE后,这个SQL可以解析过去了,但是执行时报了另外的问题
py4j.protocol.Py4JJavaError: An error occurred while calling o153.executeInsert.
: org.apache.flink.table.api.ValidationException: Currently the join key in Temporal Table Join can not be empty.
        at org.apache.flink.table.planner.plan.rules.logical.LogicalCorrelateToJoinFromGeneralTemporalTableRule.onMatch(LogicalCorrelateToJoinFromTemporalTableRule.scala:272)
        at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:333)
        at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:542)

请问要如何正确的写该SQL,是否有关于temporal table join的更详细文档?


[hidden email]