You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ingo Bürk (Jira)" <ji...@apache.org> on 2021/07/08 08:21:00 UTC
[jira] [Created] (FLINK-23307) Rowtime attributes are not properly
resolved for views
Ingo Bürk created FLINK-23307:
---------------------------------
Summary: 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
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)