malinjawi opened a new pull request, #13708:
URL: https://github.com/apache/gluten/pull/13708

   ## What changes are proposed in this pull request?
   
   `rank()` / `dense_rank()` with a limit (`rn <= k`) return wrong results on 
Velox when every ORDER BY key is also a PARTITION BY key, e.g. `partition by p, 
o order by o`. All rows of a partition tie at rank 1, so Spark keeps them all, 
but Gluten keeps only k rows per partition.
   
   No sort key is left in that case, and the converter falls back to a Velox 
RowNumber node with the limit (#7089). That was right when only row_number was 
offloaded, but #11567 enabled rank and dense_rank without changing it. For rank 
and dense_rank this now passes the rows through with an identity projection; 
row_number keeps the RowNumber node.
   
   cc @zhouyuan
   
   ## How was this patch tested?
   
   New test in `VeloxWindowExpressionSuite` (rank, dense_rank and row_number 
over overlapping keys, checking results against vanilla Spark and the row 
counts of both limit steps). It returns 42 rows instead of 400 without the fix.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (claude-opus-5-5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to