[ 
https://issues.apache.org/jira/browse/FLINK-19950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jark Wu closed FLINK-19950.
---------------------------
    Fix Version/s:     (was: 1.12.0)
       Resolution: Not A Problem

I would recognize this as a new feature that supporting temporal join on a 
view. This has been supported in master branch. 

I would recommend not to pick the commits to release-1.11, because this 
requires a Calcite version upgrade which is not state compatible and introduces 
lots of changes.

> LookupJoin can not support view or subquery and so on. o
> --------------------------------------------------------
>
>                 Key: FLINK-19950
>                 URL: https://issues.apache.org/jira/browse/FLINK-19950
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.11.0
>            Reporter: jackylau
>            Priority: Major
>
> {code:java}
> // code placeholder
> val sql0 = "create view v1 AS SELECT * FROM user_table"
> val sql = "SELECT T.id, T.len, T.content, D.name FROM src AS T JOIN v1 " +
>   "for system_time as of T.proctime AS D ON T.id = D.id"
> val sink = new TestingAppendSink
> tEnv.executeSql(sql0)
> tEnv.sqlQuery(sql).toAppendStream[Row].addSink(sink)
> env.execute()
> {code}
> {code:java}
> // code placeholder
> private void convertTemporalTable(Blackboard bb, SqlCall call) {
>   final SqlSnapshot snapshot = (SqlSnapshot) call;
>   final RexNode period = bb.convertExpression(snapshot.getPeriod());
>   // convert inner query, could be a table name or a derived table
>   SqlNode expr = snapshot.getTableRef();
>   convertFrom(bb, expr);
>   final TableScan scan = (TableScan) bb.root;
>   final RelNode snapshotRel = relBuilder.push(scan).snapshot(period).build();
>   bb.setRoot(snapshotRel, false);
> }
> {code}
> it will exist cast Exception at final TableScan scan = (TableScan) bb.root;
>  
> java.lang.ClassCastException:
> class org.apache.calcite.rel.logical.LogicalProject cannot be cast to class 
> org.apache.calcite.rel.core.TableScan 
> (org.apache.calcite.rel.logical.LogicalProject and 
> org.apache.calcite.rel.core.TableScan are in unnamed module of loader 'app')
>  



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

Reply via email to