[ 
https://issues.apache.org/jira/browse/FLINK-23307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17377202#comment-17377202
 ] 

Ingo Bürk commented on FLINK-23307:
-----------------------------------

On a side note, we should consider providing a more reasonable internal catalog 
used for tests which reflects productive usage better than 
GenericInMemoryCatalog, e.g. by faking the persistence of objects in a way that 
proper (de-)serialisation is happening.

> Rowtime attributes are not properly resolved for views
> ------------------------------------------------------
>
>                 Key: FLINK-23307
>                 URL: https://issues.apache.org/jira/browse/FLINK-23307
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.13.1
>            Reporter: Ingo Bürk
>            Priority: Major
>
> If a view is contains a rowtime attribute from an underlying table and is 
> then used in a temporal join, an error is thrown
> {quote}Temporal table join currently only supports 'FOR SYSTEM_TIME AS OF' 
> left table's time attribute field
> {quote}
> This does not happen with the generic in-memory catalog, because it copies 
> the schema as-is. However, if a catalog implementation is used which persists 
> the schema without the rowtime information (which is correct, since this is 
> defined by the underlying table and not the view itself), the catalog can 
> only return said schema for a view. This then causes this issue during 
> planning.
> Specifically, this happens in SqlCatalogViewTable#convertToRel. After the 
> call to context#expandView, the rowtime attribute is correctly present, but 
> the inserted cast from RelOptUtil#createCastRel throws this information away.
> The following SQL reproduces the issue. Again, please note that this does NOT 
> work with the default in-memory catalog:
> {code:java}
> CREATE TABLE A (
>     id INT,
>     ts TIMESTAMP(3),
>     WATERMARK FOR ts AS ts,
>     PRIMARY KEY (id) NOT ENFORCED
> ) WITH (
>     'connector' = 'datagen'
> );
> CREATE VIEW B AS SELECT * FROM A;
> SELECT * FROM B JOIN A FOR SYSTEM_TIME AS OF B.ts ON B.id = A.id;
> {code}



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

Reply via email to