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

Rion Williams edited comment on FLINK-41792 at 12/2/26, 5:40 PM:
-----------------------------------------------------------------

While fixing this I checked the other order key types and the looks like 
`RankLikeAggFunctionBase#generateInitLiteral`
there are some gaps in addition to the RANK, DENSE_RANK and PERCENT_RANK fail 
with a handful of other times:
 * TIMESTAMP_LTZ, any precision, including PROCTIME()
 * BINARY and VARBINARY (BYTES)
 * INTERVAL DAY TO SECOND types, e.g. INTERVAL SECOND(3)
 * INTERVAL YEAR TO MONTH types, e.g. INTERVAL MONTH
 * ARRAY, e.g. ARRAY<INT>
 * ROW, e.g. ROW<x INT, y INT>

The initial value from that list is never compared, because the first row of a 
partition always starts a new rank. The PR initializes the buffer with NULL of 
the order key type instead, so all of the types above work.

I'll update the ticket itself to reflect those types as well.


was (Author: rionmonster):
While fixing this I checked the other order key types and the looks like 
`RankLikeAggFunctionBase#generateInitLiteral`
there are some gaps in addition to the RANK, DENSE_RANK and PERCENT_RANK fail 
with a handful of other times:
 * TIMESTAMP_LTZ, any precision, including PROCTIME()
 * BINARY and VARBINARY (BYTES)
 * INTERVAL DAY TO SECOND types, e.g. INTERVAL SECOND(3)
 * INTERVAL YEAR TO MONTH types, e.g. INTERVAL MONTH
 * ARRAY, e.g. ARRAY<INT>
 * ROW, e.g. ROW<x INT, y INT>

The initial value from that list is never compared, because the first row of a 
partition always
starts a new rank. The PR initializes the buffer with NULL of the order key 
type instead, so all
of the types above work.

I'll update the ticket itself to reflect those types as well.

> Batch RANK, DENSE_RANK and PERCENT_RANK fail on a TIMESTAMP_LTZ order key
> -------------------------------------------------------------------------
>
>                 Key: FLINK-41792
>                 URL: https://issues.apache.org/jira/browse/FLINK-41792
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>            Reporter: Martijn Visser
>            Assignee: Rion Williams
>            Priority: Major
>
> In batch mode, RANK() OVER (PARTITION BY a ORDER BY ltz) on a 
> TIMESTAMP_LTZ(3) column fails with "Unsupported type: TIMESTAMP_LTZ(3)" from 
> RankLikeAggFunctionBase. DENSE_RANK and PERCENT_RANK fail the same way; 
> ROW_NUMBER and the other aggregates work.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to