korowa commented on code in PR #14232:
URL: https://github.com/apache/datafusion/pull/14232#discussion_r1931001534


##########
datafusion/functions-aggregate/src/first_last.rs:
##########
@@ -569,6 +573,13 @@ impl LastValueAccumulator {
             })
             .collect::<Vec<_>>();
 
+        // Order by indices for cases where the values are the same, we expect 
the last index
+        let indices: UInt64Array = (0..num_rows).map(|x| x as u64).collect();
+        sort_columns.push(SortColumn {

Review Comment:
   > The initial PR doesn't work for single partition case too since the 
get_last_idx return the first (value,order) pair not the last one
   
   Yes, my bad, lost the context for a while. Then ye, looks like providing 
unique column as an `order by` is the only way to make the output deterministic.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to