jayzhan211 commented on code in PR #14232: URL: https://github.com/apache/datafusion/pull/14232#discussion_r1929432984
########## 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: Okay, it seems like unstable sort is used in arrow-rs probably we need another stable sort in arrow-rs to not impact the current single column case. Alternative solution is that the users can add another column by themselves to get the **true** last value if they need for their scenario 🤔 Then we can keep the last value as an **unstable** version by default -- 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