UBarney commented on issue #15676: URL: https://github.com/apache/datafusion/issues/15676#issuecomment-2796150236
> FIRST_VALUE and LAST_VALUE aggregation functions are not deterministic If we include an `ORDER BY` clause, and the column used for ordering contains no duplicate values, then the results of `FIRST_VALUE` and `LAST_VALUE` can be considered deterministic. https://github.com/apache/datafusion/blob/221df48da43eca71a65d7baeb43ae82a166862e9/datafusion/sqllogictest/test_files/group_by.slt#L2687-L2700 > IMO we should at least clearly document this behaviour I believe the current documentation already makes this clear—these functions are not deterministic when no `ORDER BY` is specified: > 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. https://datafusion.apache.org/user-guide/sql/aggregate_functions.html#last-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