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

Sergey Nuyanzin commented on FLINK-24024:
-----------------------------------------

[~twalthr] sorry for the delay, probably I forgot to put some updates
{quote}
so I guess CALCITE-4337 is the missing piece to finally make SESSION TVF work 
in Flink? Or is the shortcoming you are describing another Calcite issue?
{quote}
in fact this is not clear

the error above could be fixed by overriding of 
{{org.apache.flink.table.planner.functions.sql.SqlSessionTableFunction#tableCharacteristic}}
 for {{org.apache.flink.table.planner.functions.sql.SqlSessionTableFunction}}

1. if {{SqlToRelConverter}}'s config is without expanding (Flink's case) then 
it doesn't substitute the query [1] for {{SET_SEMANTICS_TABLE}}. And a number 
of Flink cases require turned off expansion ({{withExpand(false)}}) [2]. This 
is currently not clear why do we need expansion... However without query 
substitution it is unable to generate input for 
{{ProjectWindowTableFunctionTransposeRule}}
2. If we disable requirement for expansion for {{SET_SEMANTICS_TABLE}} then we 
move a bit further and fail with unabling of generation of execution plan 
because of missing conversions {{LogicalSortExchange[convention: NONE -> 
LOGICAL]}} or {{LogicalExchange[convention: NONE -> LOGICAL]}} in case of no 
{{ORDER BY}} clause.

I'd like to to try add these conversions to see if dinally it works or not. 
Currently I see that it  (however it is a bit unfamiliar Flink's area for me, 
so it will be try/fail/learn and time consuming) 


[1] 
https://github.com/apache/calcite/blob/calcite-1.32.0/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L1377
[2] 
https://github.com/apache/flink/blob/fa61dd439ece9e2b9ef710ce2f7eed54c4d4403a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/delegation/PlannerContext.java#L306

> Support session Window TVF 
> ---------------------------
>
>                 Key: FLINK-24024
>                 URL: https://issues.apache.org/jira/browse/FLINK-24024
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: Jing Zhang
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>              Labels: pull-request-available, stale-assigned
>
>  
>  # Fix calcite syntax  CALCITE-4337
>  # Introduce session window TVF in Flink
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to