-
Notifications
You must be signed in to change notification settings - Fork 1.7k
docs: refine AggregateUDFImpl::is_ordered_set_aggregate documentation
#17805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
440ab7b
cb8facd
ceebea0
1696254
601f841
6b7b00b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -742,18 +742,23 @@ pub trait AggregateUDFImpl: Debug + DynEq + DynHash + Send + Sync { | |
| /// If this function is ordered-set aggregate function, return true | ||
| /// otherwise, return false | ||
| /// | ||
| /// Ordered-set aggregate functions require an explicit `ORDER BY` clause | ||
| /// because the calculation performed by these functions is dependent on the | ||
| /// specific sequence of the input rows, unlike other aggregate functions | ||
| /// like `SUM`, `AVG`, or `COUNT`. | ||
| /// Ordered-set aggregate functions allow an `ORDER BY` clause because the | ||
| /// calculation performed by these functions is dependent on the specific | ||
| /// sequence of the input rows, unlike other aggregate functions like `SUM` | ||
| /// `AVG`, or `COUNT`. If explicit order is specified then a default order | ||
| /// of ascending is assumed. | ||
| /// | ||
| /// An example of an ordered-set aggregate function is `percentile_cont` | ||
| /// which computes a specific percentile value from a sorted list of values, and | ||
| /// is only meaningful when the input data is ordered. | ||
| /// Note that setting this to `true` does not guarantee input sort order to | ||
|
||
| /// the aggregate function; it instead gives the function full control over | ||
| /// the sorting process and they are expected to handle order of input values | ||
| /// themselves. | ||
|
||
| /// | ||
| /// An example of an ordered-set aggregate function is `approx_percentile_cont` | ||
| /// which computes an approximate percentile value from a sorted list of values. | ||
| /// | ||
| /// In SQL syntax, ordered-set aggregate functions are used with the | ||
| /// `WITHIN GROUP (ORDER BY ...)` clause to specify the ordering of the input | ||
| /// data. | ||
| /// data, or can be simply omitted to assume ascending. | ||
| fn is_ordered_set_aggregate(&self) -> bool { | ||
| false | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically we don't enforce the default order; our only ordered set aggregate functions internally use ascending as the default, so I'm not sure if we should instead say its implementation dependent or try to enforce it somehow?