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

xuyang commented on FLINK-35792:
--------------------------------

Let me summarize:

In the Rank, if the order key includes a proctime attribute column, an error 
will be raised: "Rank does not support ordering by a proctime column."

Unlike before, I will not suggest replacing it with {{now()}} because doing so 
sacrifices some precision relative to the semantics of proctime.

Additionally, it's worth noting that using event time columns as order keys is 
allowed. Internally, they are treated as regular time columns for sorting. We 
adhere to the principle of producing results that are consistent with batch 
processing, as well as the "AND CURRENT ROW" principle, so there's no need to 
discard late data solely based on its event time attribute.
 
 

> Sorting by proctime does not work in rank
> -----------------------------------------
>
>                 Key: FLINK-35792
>                 URL: https://issues.apache.org/jira/browse/FLINK-35792
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.20.0, 1.19.1
>            Reporter: xuyang
>            Assignee: xuyang
>            Priority: Major
>
> Take the following sql as an example:
> {code:java}
> @Test
> def test(): Unit = {
>   val sql =
>     """
>       |SELECT *
>       |FROM (
>       |  SELECT a, b, c,
>       |      ROW_NUMBER() OVER (PARTITION BY a ORDER BY b, proctime DESC) as 
> rank_num
>       |  FROM MyTable)
>       |WHERE rank_num = 1
>     """.stripMargin
>   // This rank can't be converted into Deduplicated because it also uses `b`  
>  
>   // as order key.    
>   util.verifyExecPlan(sql)
> } {code}
> The rank node will not materialize the `proctime` in 
> `RelTimeIndicatorConverter`, thus the order key `proctime` is always null.



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

Reply via email to