Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EC31717793 for ; Tue, 7 Apr 2015 01:44:12 +0000 (UTC) Received: (qmail 13953 invoked by uid 500); 7 Apr 2015 01:44:12 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 13891 invoked by uid 500); 7 Apr 2015 01:44:12 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 13847 invoked by uid 99); 7 Apr 2015 01:44:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2015 01:44:12 +0000 Date: Tue, 7 Apr 2015 01:44:12 +0000 (UTC) From: "Kristine Hahn (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (DRILL-2214) Aggregate function documentation needs to be corrected MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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)