Return-Path: X-Original-To: apmail-asterixdb-dev-archive@minotaur.apache.org Delivered-To: apmail-asterixdb-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9E90218FD5 for ; Thu, 19 Nov 2015 01:55:36 +0000 (UTC) Received: (qmail 69387 invoked by uid 500); 19 Nov 2015 01:55:36 -0000 Delivered-To: apmail-asterixdb-dev-archive@asterixdb.apache.org Received: (qmail 69332 invoked by uid 500); 19 Nov 2015 01:55:36 -0000 Mailing-List: contact dev-help@asterixdb.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.incubator.apache.org Delivered-To: mailing list dev@asterixdb.incubator.apache.org Received: (qmail 69320 invoked by uid 99); 19 Nov 2015 01:55:36 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2015 01:55:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C23151A2CF1 for ; Thu, 19 Nov 2015 01:55:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.901 X-Spam-Level: ** X-Spam-Status: No, score=2.901 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id PvWH2ukV3XUr for ; Thu, 19 Nov 2015 01:55:21 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 5F82543DC8 for ; Thu, 19 Nov 2015 01:55:21 +0000 (UTC) Received: by oixx65 with SMTP id x65so36726608oix.0 for ; Wed, 18 Nov 2015 17:55:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type; bh=kOqQQ/okfT2u5eg6x6vpfWx6g+wlMWUSllcgrPwjKpQ=; b=ucWO5hGmmEqMjoWWpoca75a1VFGxNtKwW4fngbSV15U0yob7oAxgqTEYo0ISBXk4g8 VNn3LSPSHhi9Ia5rSRniiJEBhauBrSnmaVxtVXj/+mgKMPs1iwofevx4Jkk+UPl7QbPh yi3TO6FyNaEapamRJve7Xns0ypNmgXlROKkub3gHgTJZrT2GC138CSynq6w4chrUXra+ qvrCAX2HVwp1vtTAdmyCNDuieTrDqbH9+PBwHro+1tHSABBW5moCrd64ugh1K9reYASC vSlHtRzyDwKXVTlsu88N7Ol/NRu4C2zDxp/oGF1e+lAawsHnM5zI9eoOVW5T4uo7cLvx GkWQ== X-Received: by 10.202.67.131 with SMTP id q125mr1049317oia.40.1447898120968; Wed, 18 Nov 2015 17:55:20 -0800 (PST) Received: from mikejcarey.local (ip72-219-184-46.oc.oc.cox.net. [72.219.184.46]) by smtp.googlemail.com with ESMTPSA id s203sm2400245ois.29.2015.11.18.17.55.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Nov 2015 17:55:20 -0800 (PST) Subject: Re: Postgres Aggregation Function - Discussion To: dev@asterixdb.incubator.apache.org References: From: Mike Carey Message-ID: <564D2C07.1030503@gmail.com> Date: Wed, 18 Nov 2015 17:55:19 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------010109070807060403070309" --------------010109070807060403070309 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit James, We all need to look at this!!! Sorry sorry sorry! I will have a look ASAP (by early next week, say Tuesday since that's traditionally a "UCR day" for me, at the latest). Question - what do you mean by "do we want a scalar or aggregate version" of the functions? It seems like we don't have a choice, do we? Aren't they inherently aggregate functions (so the answer would be the latter)? I think maybe I didn't get the gist of the question. On the SQL vs. AQL versions - it would be nice to have both versions of each (aggregate) function, actually - i.e., one version that does what SQL does in terms of turning a blind eye to nulls, and one version that does what AQL does, which is to say that if you have a null (a.k.a. unknown) input then the output must logically be unknown as well (e.g., if you add two numbers by either doing "+" or having them appear in a two-object dataset's numeric column and doing sum( ), you should get the same answer either way). More to follow when I look more closely! Sorry we've all been so slow. (@Others: your take(s)?) Cheers, Mike On 11/18/15 2:06 PM, James Fang wrote: > Just wondering if anyone has a response on this discussion? > > Thanks, > James > > On Mon, Nov 9, 2015 at 2:11 PM, James Fang wrote: > >> The following functions that I am asking about are from >> http://www.postgresql.org/docs/9.4/static/functions-aggregate.html >> >> The following google doc contains a spreadsheet of all the current >> aggregation functions that exist in AQL and SQL. The colored portions will >> be the portions that I wish to discuss. I assumed that AQL returns null if >> at least 1 of the results in the aggregation is null while SQL ignores the >> tuple if it is null. >> >> https://docs.google.com/document/d/1l9QtRAB7H3yzP3976livpKzJZHVJlPdvDrjlm2YCsM0/edit?usp=sharing >> >> Questions: >> 1) Do we need array_agg, this function just groups up the results together >> into one array as output. If so, do we want a scalar version or aggregate >> version? >> 2) For bitwise-or and bitwise-and, I have implemented a sql aggregate >> version. Do we want a AQL aggregate version as well? Do you think that we >> should implement this as a scalar or as an aggregation? >> 3) For boolean-or and boolean and, we current have an existing scalar >> version for AQL. Do we need a scalar version for SQL? Should we implement a >> aggregate version of these boolean functions? >> 4) Do we need a json_agg function? I do not think so because all the data >> is returned in json format. If you have a different answer, let me know. >> 5) For string_agg, we currently have a scalar version for AQL known as >> string-join. Do we need a SQL version? >> --------------010109070807060403070309--