[
https://issues.apache.org/jira/browse/CALCITE-5283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde resolved CALCITE-5283.
----------------------------------
Resolution: Fixed
Fixed in
[20014b6c|https://github.com/apache/calcite/commit/20014b6c5b9b57d29248206f19d63ef50f7a5c0f];
thanks for the PR, [~FrankZou]!
> Add ARG_MIN, ARG_MAX (aka MIN_BY, MAX_BY) aggregate functions
> -------------------------------------------------------------
>
> Key: CALCITE-5283
> URL: https://issues.apache.org/jira/browse/CALCITE-5283
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Zou
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.33.0
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Add ARG_MIN, ARG_MAX (aka MIN_BY, MAX_BY) aggregate functions.
> For example, the following query prints the name of the lowest paid employee
> in each department:
> {code:java}
> SELECT deptno, ARG_MIN(sal, ename)
> FROM emp
> GROUP BY deptno;
> +------------+------------+
> | deptno | _c1 |
> +------------+------------+
> | 10 | MILLER |
> | 20 | SMITH |
> | 30 | JAMES |
> +------------+------------+
> {code}
> If multiple employees have the same salary, arbitrarily chooses one to return.
> See [Yandex description of
> ARG_MIN|https://cloud.yandex.com/en/docs/datalens/function-ref/ARG_MIN]. Also
> implemented in Alibaba MaxCompute, Clickhouse, DuckDB. (And in Alibaba
> MaxCompute, Spark SQL, Firebolt, PrestoDB, Trino as MIN_BY/MAX_BY.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)