Dawid Wysakowicz created FLINK-20307:
----------------------------------------
Summary: Cannot alias versioned table in a join
Key: FLINK-20307
URL:
https://issues.apache.org/jira/browse/FLINK-20307 Project: Flink
Issue Type: Improvement
Components: Table SQL / Planner
Reporter: Dawid Wysakowicz
Fix For: 1.12.0
A query like:
{code}
SELECT p.name, p.qty * r.rate AS price, p.`tstamp` FROM Products p JOIN versioned_rates r FOR SYSTEM_TIME AS OF p.`tstamp` ON p.currency = r.currency;
{code}
fails with:
{code}
[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.sql.parser.impl.ParseException: Encountered "FOR" at line 1, column 108.
Was expecting one of:
<EOF>
"EXCEPT" ...
"FETCH" ...
"GROUP" ...
"HAVING" ...
"INTERSECT" ...
"LIMIT" ...
"OFFSET" ...
"ON" ...
"ORDER" ...
"MINUS" ...
"TABLESAMPLE" ...
"UNION" ...
"USING" ...
"WHERE" ...
"WINDOW" ...
"(" ...
"NATURAL" ...
"JOIN" ...
"INNER" ...
"LEFT" ...
"RIGHT" ...
"FULL" ...
"CROSS" ...
"," ...
"OUTER" ...
{code}
When I do not alias the {{versioned_rates}} table everything works as expected. Therefore query like just runs:
{code}
SELECT p.name, p.qty * versioned_rates.rate AS price, p.`tstamp` FROM Products p JOIN versioned_rates FOR SYSTEM_TIME AS OF p.`tstamp` ON p.currency = versioned_rates.currency;
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)