drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristine Hahn (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (DRILL-2214) Aggregate function documentation needs to be corrected
Date Tue, 07 Apr 2015 01:44:12 GMT

     [ https://issues.apache.org/jira/browse/DRILL-2214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Kristine Hahn resolved DRILL-2214.
----------------------------------
    Resolution: Fixed

The info about DISTINCT and ALL has been added to the doc. Included your examples, also: http://drill.apache.org/docs/aggregate-and-aggregate-statistical/

> Aggregate function documentation needs to be corrected
> ------------------------------------------------------
>
>                 Key: DRILL-2214
>                 URL: https://issues.apache.org/jira/browse/DRILL-2214
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 0.8.0
>            Reporter: Victoria Markman
>            Assignee: Kristine Hahn
>
> It turns out that all of our basic aggregate functions (MIN, MAX, COUNT, AVG, SUM) accept
ALL and DISTINCT keywords.
> If none specified, ALL is the default.
> For example,
> {code}
> 0: jdbc:drill:schema=dfs> select a2 from t2;
> +------------+
> |     a2     |
> +------------+
> | 0          |
> | 1          |
> | 2          |
> | 2          |
> | 2          |
> | 3          |
> | 4          |
> | 5          |
> | 6          |
> | 7          |
> | 7          |
> | 8          |
> | 9          |
> +------------+
> 13 rows selected (0.056 seconds)
> 0: jdbc:drill:schema=dfs> select avg(all a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 4.3076923076923075 |
> +------------+
> 1 row selected (0.084 seconds)
> 0: jdbc:drill:schema=dfs> select avg(distinct a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 4.5        |
> +------------+
> 1 row selected (0.079 seconds)
> 0: jdbc:drill:schema=dfs> select sum(all a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 56         |
> +------------+
> 1 row selected (0.086 seconds)
> 0: jdbc:drill:schema=dfs> select sum(distinct a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 45         |
> +------------+
> 1 row selected (0.078 seconds)
> +------------+
> |   EXPR$0   |
> +------------+
> | 13         |
> +------------+
> 1 row selected (0.056 seconds)
> 0: jdbc:drill:schema=dfs> select count(all a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 13         |
> +------------+
> 1 row selected (0.056 seconds)
> 0: jdbc:drill:schema=dfs> select count(distinct a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 10         |
> +------------+
> 1 row selected (0.074 seconds)
> {code}
> Including MIN/MAX:
> {code}
> 0: jdbc:drill:schema=dfs> select min(distinct a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 0          |
> +------------+
> 1 row selected (0.095 seconds)
> 0: jdbc:drill:schema=dfs> select min(all a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 0          |
> +------------+
> 1 row selected (0.065 seconds)
> 0: jdbc:drill:schema=dfs> select max(all a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 9          |
> +------------+
> 1 row selected (0.094 seconds)
> 0: jdbc:drill:schema=dfs> select max(distinct a2) from t2;
> +------------+
> |   EXPR$0   |
> +------------+
> | 9          |
> +------------+
> 1 row selected (0.067 seconds)
> {code}
> I don't know if we should mention MIN/MAX, but SUM and AVG we should.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message