You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zou (Jira)" <ji...@apache.org> on 2022/12/26 08:38:00 UTC

[jira] [Commented] (CALCITE-5283) Add ARG_MIN, ARG_MAX (aka MIN_BY, MAX_BY) aggregate functions

    [ https://issues.apache.org/jira/browse/CALCITE-5283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17651968#comment-17651968 ] 

Zou commented on CALCITE-5283:
------------------------------

Hi, could someone help review this [PR|[http://example.com|https://github.com/apache/calcite/pull/2981]]?
[http|http://dict.youdao.com/search?q=http&keyfrom=chrome.extension]  [ˌeɪtʃ tiː tiː ˈpiː]  [详细|http://dict.youdao.com/search?q=http&keyfrom=chrome.extension]X
基本翻译
abbr. 超文本传输协议 (hypertext transport protocol)
网络释义
[http:|http://dict.youdao.com/search?q=http&keyfrom=chrome.extension&le=eng] 网站
[http-equiv:|http://dict.youdao.com/search?q=http-equiv&keyfrom=chrome.extension&le=eng] 信息
[S-HTTP:|http://dict.youdao.com/search?q=S-HTTP&keyfrom=chrome.extension&le=eng] 协议

> 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
>          Time Spent: 10m
>  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)