jayzhan211 commented on issue #15676: URL: https://github.com/apache/datafusion/issues/15676#issuecomment-2796351960
I think the undeterministic is based on the input not order-preserved, so if the input is order-preserved, we can have deterministic result for first/last. > Returns the last element in an aggregation group according to the requested ordering. If no ordering is given, returns an arbitrary element from the group. LastValue: Returns the last element in an aggregation group (if any), based on the specified ordering. - If the input is not order-preserved, the result may be non-deterministic. - If no ordering is specified, the function returns the last value in the group. - If ordering is specified, it returns the first value among those with the same ordering keys, due to the performance reason, See https://github.com/apache/datafusion/pull/14232 FirstValue: Returns the first element in an aggregation group (if any), based on the specified ordering. - If the input is not order-preserved, the result may be non-deterministic. - If no ordering is specified, the function returns the first value in the group. - If ordering is specified, it returns the first value. -- 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