Support EXPR_MIN, EXPR_MAX aggregation functions
- Dominant language
- Java
- Stars
- 6.1k
- Forks
- 1.5k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 189
Description
Naming can be discussed but here is what the functions should do
An aggregation only query will return exactly one row and one column as the output of the aggregation function. So for example, we can do sum/min/max on a column and get the sum/min/max computed over the column values.
When aggregations are used with GROUP BY, the output rows are going to contain GROUP BY columns along with 0 or more aggregation columns.
However, there is currently no way to do the aggregation over one column by doing the computation min/max over the column values and return another column value corresponding to the minimum/maximum value in the aggregation column.
Examples
- For each unique member, return all columns where timestamp is maximum
-- SELECT id, EXPR_MAX(timestamp, *) FROM Foo GROUP BY id. MAX will be done over timestamp column but all columns will be returned
- For each unique product, find the cheapest supplier
-- SELECT product, EXPR_MIN(price, supplier) FROM Foo GROUP BY product. MIN will be done over price column but supplier column will be returned along with product group by column
Function will take two arguments
- Name of column to minimize/maximize just like we do today with MIN() and MAX()
- Names of column(s) (could be *) to return corresponding to minimized/maximized value
Contributor guide
Assessment
This issue has not been assessed yet.