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 7AFE3200C4E for ; Fri, 21 Apr 2017 17:50:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 79AD2160BB2; Fri, 21 Apr 2017 15:50: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 957CC160BA2 for ; Fri, 21 Apr 2017 17:50:08 +0200 (CEST) Received: (qmail 49832 invoked by uid 500); 21 Apr 2017 15:50: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 49823 invoked by uid 99); 21 Apr 2017 15:50:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Apr 2017 15:50:07 +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 5AE631AFBFA for ; Fri, 21 Apr 2017 15:50:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, 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 (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id TVS6-4jV3I2G for ; Fri, 21 Apr 2017 15:50: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 E3BD95FD29 for ; Fri, 21 Apr 2017 15:50: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 6396FE06C5 for ; Fri, 21 Apr 2017 15:50: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 20F8821B53 for ; Fri, 21 Apr 2017 15:50:04 +0000 (UTC) Date: Fri, 21 Apr 2017 15:50:04 +0000 (UTC) From: "Dudu Markovitz (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-16496) Enhance asterisk expression (as in "select *") with EXCLUDE clause MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 21 Apr 2017 15:50:09 -0000 [ https://issues.apache.org/jira/browse/HIVE-16496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dudu Markovitz updated HIVE-16496: ---------------------------------- Description: support the following syntax: {code} select * exclude (a,b,e) from t {code} which for a table t with columns a,b,c,d,e would be equal to: {code} select c,d from t {code} Please note that the EXCLUDE clause relates directly to its preceding asterisk. A common use case would be: {code} select t1.* exclude (x), t2.* from t1 join t2 on t1.x=t2.x; {code} This supplies a very clean way to select all columns without getting "Ambiguous column reference" and without the need to specify all the columns of at least one of the tables. Currently, without this enhancement, the query would look something like this: {code} select a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,y,z,t2.* from t1 join t2 on t1.x=t2.x; {code} Considering a table may hold hundreds or even thousands of column, this can be come very ugly and error prone. Often this require some scripting work. h4. Extended syntax: positional notation support {code} select * exclude ($(1,2,5)) from t -- exclude columns 1, 2 and 5 select * exclude ($(1-3)) from t -- exclude columns 1 to 3 select * exclude ($(1,3-5,7)) from t -- exclude columns 1,3 to 5 and 7 select * exclude ($(7,3-5,1)) from t -- exclude columns 1,3 to 5 and 7 (same as previous example) select * exclude ($(3,5-)) from t -- exclude the 3rd column and all columns from the 5th column to the end select * exclude (-$(1,2)) from t -- exclude last 2 columns select * exclude (-$(1-3,7)) from t -- exclude last 3 columns and the 7th column from the end select * exclude (-$(4-)) from t -- exclude all columns except for the last 3 {code} A complex example would look like: {code} select * exclude ($(1-3,5,7),x,y,-$(1-2)) from t {code} exclude: - first 3 columns - 5th and 7th columns - x and y - last 2 columns P.s. 1 There should be *no* error raised for the following scenarios: - Excluding a column that does not exists in the columns set - Excluding the same column more than once (e.g. by name and by position). - Excluding all columns P.s. 2 This enhancement answers a real need that is being raised again again in the Hive users community as well in legacy RDBMS communities. As far as I know, no provider had yet implemented something similar and we have an opportunity here to lead the SQL ecosystem. was: support the following syntax: {code} select * exclude (a,b,e) from t {code} which for a table t with columns a,b,c,d,e would be equal to: {code} select c,d from t {code} Please note that the EXCLUDE clause relates directly to its preceding asterisk. A common use case would be: {code} select t1.* exclude (x), t2.* from t1 join t2 on t1.x=t2.x; {code} This supplies a very clean way to select all columns without getting "Ambiguous column reference" and without the need to specify all the columns of at least one of the tables. Currently, without this enhancement, the query would look something like this: {code} select a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,y,z,t2.* from t1 join t2 on t1.x=t2.x; {code} Considering a table may hold hundreds or even thousands of column, this can be come very ugly and error prone. Often this require some scripting work. h4. Extended syntax: positional notation support {code} select * exclude ($(1,2,5)) from t -- exclude columns 1, 2 and 5 select * exclude ($(1-3)) from t -- exclude columns 1 to 3 select * exclude ($(1,3-5,7)) from t -- exclude columns 1,3 to 5 and 7 select * exclude ($(7,3-5,1)) from t -- exclude columns 1,3 to 5 and 7 (same as previous example)*/ select * exclude ($(3,5-)) from t -- exclude the 3rd column and all columns from the 5th column to the end select * exclude (-$(1,2)) from t -- exclude last 2 columns select * exclude (-$(1-3,7)) from t -- exclude last 3 columns and the 7th column from the end select * exclude (-$(4-)) from t -- exclude all columns except for the last 3 {code} A complex example would look like: {code} select * exclude ($(1-3,5,7),x,y,-$(1-2)) from t {code} exclude: - first 3 columns - 5th and 7th columns - x and y - last 2 columns P.s. 1 There should be *no* error raised for the following scenarios: - Excluding a column that does not exists in the columns set - Excluding the same column more than once (e.g. by name and by position). - Excluding all columns P.s. 2 This enhancement answers a real need that is being raised again again in the Hive users community as well in legacy RDBMS communities. As far as I know, no provider had yet implemented something similar and we have an opportunity here to lead the SQL ecosystem. > Enhance asterisk expression (as in "select *") with EXCLUDE clause > ------------------------------------------------------------------ > > Key: HIVE-16496 > URL: https://issues.apache.org/jira/browse/HIVE-16496 > Project: Hive > Issue Type: Wish > Components: Parser > Reporter: Dudu Markovitz > > support the following syntax: > {code} > select * exclude (a,b,e) from t > {code} > which for a table t with columns a,b,c,d,e would be equal to: > {code} > select c,d from t > {code} > Please note that the EXCLUDE clause relates directly to its preceding asterisk. > A common use case would be: > {code} > select t1.* exclude (x), t2.* from t1 join t2 on t1.x=t2.x; > {code} > This supplies a very clean way to select all columns without getting "Ambiguous column reference" and without the need to specify all the columns of at least one of the tables. > > Currently, without this enhancement, the query would look something like this: > {code} > select a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,y,z,t2.* from t1 join t2 on t1.x=t2.x; > {code} > Considering a table may hold hundreds or even thousands of column, this can be come very ugly and error prone. > Often this require some scripting work. > h4. Extended syntax: positional notation support > {code} > select * exclude ($(1,2,5)) from t -- exclude columns 1, 2 and 5 > select * exclude ($(1-3)) from t -- exclude columns 1 to 3 > select * exclude ($(1,3-5,7)) from t -- exclude columns 1,3 to 5 and 7 > select * exclude ($(7,3-5,1)) from t -- exclude columns 1,3 to 5 and 7 (same as previous example) > select * exclude ($(3,5-)) from t -- exclude the 3rd column and all columns from the 5th column to the end > select * exclude (-$(1,2)) from t -- exclude last 2 columns > select * exclude (-$(1-3,7)) from t -- exclude last 3 columns and the 7th column from the end > select * exclude (-$(4-)) from t -- exclude all columns except for the last 3 > {code} > A complex example would look like: > {code} > select * exclude ($(1-3,5,7),x,y,-$(1-2)) from t > {code} > exclude: > - first 3 columns > - 5th and 7th columns > - x and y > - last 2 columns > P.s. 1 > There should be *no* error raised for the following scenarios: > - Excluding a column that does not exists in the columns set > - Excluding the same column more than once (e.g. by name and by position). > - Excluding all columns > P.s. 2 > This enhancement answers a real need that is being raised again again in the Hive users community as well in legacy RDBMS communities. > As far as I know, no provider had yet implemented something similar and we have an opportunity here to lead the SQL ecosystem. > -- This message was sent by Atlassian JIRA (v6.3.15#6346)