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

Fabian Hueske commented on FLINK-5710:
--------------------------------------

The idea is to kind of apply pattern matching for certain expressions such as 
{{GROUP BY FLOOR(procTime() TO HOURS)}}.
The challenge is that this expression is spread across several LogicalRel nodes.
The expression {{FLOOR(procTime() TO HOURS)}} will be moved into a 
{{LogicalProject}} (or {{LogicalCalc}}) to create a new attribute. A following 
{{LogicalAggregate}} will then use that attribute as a grouping column.

Once we detect such a pattern, we have to rewrite the plan and replace the 
{{LogicalAggregate}} and parts of the {{LogicalProject}} by a  
{{LogicalWindowAggregate}}. The {{LogicalWindowAggregate}} includes a window 
definition. Depending on which marker function is used ({{rowtime}} or 
{{proctime}}) the window definition is either for a processing or an event time 
window. After the translation, the function is no longer available.

With this approach, we can only translate very specific queries. However, I 
don't think we can easily provide a generic translation for SQL window queries.

> Add ProcTime() function to indicate StreamSQL
> ---------------------------------------------
>
>                 Key: FLINK-5710
>                 URL: https://issues.apache.org/jira/browse/FLINK-5710
>             Project: Flink
>          Issue Type: New Feature
>          Components: DataStream API
>            Reporter: Stefano Bortoli
>            Assignee: Stefano Bortoli
>            Priority: Minor
>
> procTime() is a parameterless scalar function that just indicates processing 
> time mode



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to