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

Flink Jira Bot updated FLINK-20226:
-----------------------------------
    Labels: auto-deprioritized-major stale-minor  (was: 
auto-deprioritized-major)

I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help 
the community manage its development. I see this issues has been marked as 
Minor but is unassigned and neither itself nor its Sub-Tasks have been updated 
for 180 days. I have gone ahead and marked it "stale-minor". If this ticket is 
still Minor, please either assign yourself or give an update. Afterwards, 
please remove the label or in 7 days the issue will be deprioritized.


> Temporal Table Functions cannot be created with a view reference
> ----------------------------------------------------------------
>
>                 Key: FLINK-20226
>                 URL: https://issues.apache.org/jira/browse/FLINK-20226
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.12.0
>            Reporter: Benoît Paris
>            Priority: Minor
>              Labels: auto-deprioritized-major, stale-minor
>         Attachments: flink-test-temporal-table-function-from.zip
>
>
> Temporal Table Functions fail to be created if the history side `Table` is 
> obtained through `StreamTableEnvironment.from`.
> With:
>  
> {code:java}
> CREATE VIEW datagen_history_v AS
> SELECT 
>  f_random_str,
>  COALESCE(ts, null) AS ts,
>  f_random + 1 AS f_random
> FROM datagen_history{code}
>  
> This will create a Temporal Table Function that fail while being queried 
> later on:
> {code:java}
> Table historyTable = tEnv.from("datagen_history_v");
> TemporalTableFunction temporalTable = 
> historyTable.createTemporalTableFunction( $("ts"), $("f_random_str"));
> tEnv.registerFunction("datagen_ttf", temporalTable);{code}
>  
> There is a simple workaround: If the view is obtained through a query 
> referencing it, it will succeed later on:
>  
> {code:java}
> Table historyTable = tEnv.sqlQuery("SELECT * FROM datagen_history_v");
> TemporalTableFunction temporalTable = 
> historyTable.createTemporalTableFunction( $("ts"), $("f_random_str"));
> tEnv.registerFunction("datagen_ttf", temporalTable);{code}
>  
> ----
> Included for reproduction: a pom.xml, one succeeding java case, one failing 
> java case, and the associated failing stacktrace.
> It seems to be that the view reference has been made physical as a side 
> effect of the query; as opposed to still being a view reference when `from` 
> has been used.
> Calcite's `Relbuilder` will need an `ExpandingPreparingTable` that is a 
> `QueryOperationCatalogViewTable`, and instead is getting a 
> `SqlCatalogViewTable`.
> Now, as to knowing where and how the runtime could operate that conversion, I 
> wouldn't know.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to