Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 05F20200CBE for ; Thu, 1 Jun 2017 21:37:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0505B160BC4; Thu, 1 Jun 2017 19:37:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 572E1160BE3 for ; Thu, 1 Jun 2017 21:37:08 +0200 (CEST) Received: (qmail 52532 invoked by uid 500); 1 Jun 2017 19:37:07 -0000 Mailing-List: contact issues-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list issues@hive.apache.org Received: (qmail 52170 invoked by uid 99); 1 Jun 2017 19:37:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jun 2017 19:37:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id C8A001812FA for ; Thu, 1 Jun 2017 19:37:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id G6gXiaqGZGSK for ; Thu, 1 Jun 2017 19:37:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D97A55F2AE for ; Thu, 1 Jun 2017 19:37:04 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 691AEE05F7 for ; Thu, 1 Jun 2017 19:37:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2A3FA21B57 for ; Thu, 1 Jun 2017 19:37:04 +0000 (UTC) Date: Thu, 1 Jun 2017 19:37:04 +0000 (UTC) From: "Julian Hyde (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HIVE-15996) Implement multiargument GROUPING function MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 01 Jun 2017 19:37:09 -0000 [ https://issues.apache.org/jira/browse/HIVE-15996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16033545#comment-16033545 ] Julian Hyde commented on HIVE-15996: ------------------------------------ I was mistaken about {{GROUP_ID()}} being equivalent to {{GROUPING(x, y, z)}} (assuming the query has {{GROUP BY x, y, z}}). In fact, {{GROUP_ID()}} should return zero unless you have a query with duplicate grouping sets (which is very unusual). Furthermore, {{GROUP_ID()}} is Oracle-specific and non-standard. See CALCITE-1824 for more details. > Implement multiargument GROUPING function > ----------------------------------------- > > Key: HIVE-15996 > URL: https://issues.apache.org/jira/browse/HIVE-15996 > Project: Hive > Issue Type: New Feature > Affects Versions: 2.2.0 > Reporter: Carter Shanklin > Assignee: Jesus Camacho Rodriguez > Fix For: 3.0.0 > > Attachments: HIVE-15996.01.patch, HIVE-15996.02.patch, HIVE-15996.03.patch, HIVE-15996.04.patch > > > Per the SQL standard section 6.9: > GROUPING ( CR1, ..., CRN-1, CRN ) > is equivalent to: > CAST ( ( 2 * GROUPING ( CR1, ..., CRN-1 ) + GROUPING ( CRN ) ) AS IDT ) > So for example: > select c1, c2, c3, grouping(c1, c2, c3) from e011_02 group by rollup(c1, c2, c3); > Should be allowed and equivalent to: > select c1, c2, c3, 4*grouping(c1) + 2*grouping(c2) + grouping(c3) from e011_02 group by rollup(c1, c2, c3); -- This message was sent by Atlassian JIRA (v6.3.15#6346)