You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Hailin Wang (Jira)" <ji...@apache.org> on 2022/04/06 10:41:00 UTC

[jira] [Commented] (FLINK-23307) Rowtime attributes are not properly resolved for views

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

Hailin Wang commented on FLINK-23307:
-------------------------------------

same problem here

https://github.com/apache/iceberg/blob/master/flink/v1.13/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java

> 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
>            Assignee: 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.20.1#820001)