Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-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 71DA1D57A for ; Mon, 15 Oct 2012 06:55:04 +0000 (UTC) Received: (qmail 3214 invoked by uid 500); 15 Oct 2012 06:55:03 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 2714 invoked by uid 500); 15 Oct 2012 06:55:03 -0000 Mailing-List: contact dev-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 dev@hive.apache.org Received: (qmail 2596 invoked by uid 500); 15 Oct 2012 06:55:03 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 2587 invoked by uid 99); 15 Oct 2012 06:55:03 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Oct 2012 06:55:03 +0000 Date: Mon, 15 Oct 2012 06:55:03 +0000 (UTC) From: "Shengsheng Huang (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: <1131923500.44424.1350284103241.JavaMail.jiratomcat@arcas> In-Reply-To: <475056899.44417.1350283983677.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (HIVE-3577) Subquery Unnesting 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/HIVE-3577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Shengsheng Huang updated HIVE-3577: ----------------------------------- Description: Hive requires subquery to be used only in the FROM clause. But real-world queries can be much more complex and subqueries could appear in WHERE, having and SELECT clauses. Many of such subqueries can be transformed/unnested to various join operations. This is an umbrella id to include all subquery unnesting work, specifically: 1. subquery in WHERE conditions, including subquery used as operand of IN, EXISTS, ISNULL ALL/ANY/SOME, and etc. 2. correlated subquery (a correlated subquery is a subquery that refers to a column of a table not in its FROM clause),e.g. {code} select * from t1 where exists ( select * from t2 where t1.b = t2.y ); {code} 3. scalar subquery (a subquery that returns exactly one column value from one row). e.g. {code} select a,b,c,d,e,(select z from t2 where t2.y = t1.b and z != 99 ) from t1; {code} 4. top-level subquery, e.g. {code} (select * from t1) union all (select * from t2) union (all select * from t3 order by 1); {code} was: Hive requires subquery to be used only in the FROM clause. But real-world queries can be much more complex and subqueries could appear in WHERE, having and SELECT clauses. Many of such subqueries can be transformed/unnested to various join operations. This is an umbrella id to include all subquery unnesting work, specifically: 1. subquery in WHERE conditions, including subquery used as operand of IN, EXISTS, ISNULL ALL/ANY/SOME, and etc. 2. correlated subquery (a correlated subquery is a subquery that refers to a column of a table not in its FROM clause) {code} select * from t1 where exists ( select * from t2 where t1.b = t2.y ); {code} 3. scalar subquery (a subquery that returns exactly one column value from one row) e.g. select a,b,c,d,e,(select z from t2 where t2.y = t1.b and z != 99 ) from t1; 4. top-level subquery (select * from t1) union all (select * from t2) union (all select * from t3 order by 1); > Subquery Unnesting > ------------------ > > Key: HIVE-3577 > URL: https://issues.apache.org/jira/browse/HIVE-3577 > Project: Hive > Issue Type: Sub-task > Affects Versions: 0.10.0 > Reporter: Shengsheng Huang > > Hive requires subquery to be used only in the FROM clause. But real-world queries can be much more complex and subqueries could appear in WHERE, having and SELECT clauses. Many of such subqueries can be transformed/unnested to various join operations. This is an umbrella id to include all subquery unnesting work, specifically: > 1. subquery in WHERE conditions, including subquery used as operand of IN, EXISTS, ISNULL ALL/ANY/SOME, and etc. > 2. correlated subquery (a correlated subquery is a subquery that refers to a column of a table not in its FROM clause),e.g. > {code} > select * from t1 where exists ( select * from t2 where t1.b = t2.y ); > {code} > 3. scalar subquery (a subquery that returns exactly one column value from one row). e.g. > {code} > select a,b,c,d,e,(select z from t2 where t2.y = t1.b and z != 99 ) from t1; > {code} > 4. top-level subquery, e.g. > {code} > (select * from t1) union all (select * from t2) union (all select * from t3 order by 1); > {code} > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira