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 405E8200BEA for ; Mon, 12 Dec 2016 18:02:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3D528160B22; Mon, 12 Dec 2016 17:02:00 +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 7EF8E160B2D for ; Mon, 12 Dec 2016 18:01:59 +0100 (CET) Received: (qmail 55343 invoked by uid 500); 12 Dec 2016 17:01:58 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 55231 invoked by uid 99); 12 Dec 2016 17:01:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Dec 2016 17:01:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 712A52C03E3 for ; Mon, 12 Dec 2016 17:01:58 +0000 (UTC) Date: Mon, 12 Dec 2016 17:01:58 +0000 (UTC) From: "Nattavut Sutyanyong (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SPARK-18603) Support `OuterReference` in projection list of IN correlated subqueries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 12 Dec 2016 17:02:00 -0000 [ https://issues.apache.org/jira/browse/SPARK-18603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15742455#comment-15742455 ] Nattavut Sutyanyong commented on SPARK-18603: --------------------------------------------- More examples: {code:sql} -- A silly subquery SELECT * FROM A WHERE A.a1 IN (SELECT MAX(A.a2) FROM B) {code} {code:sql} SELECT * FROM A WHERE A.value IN (SELECT CASE WHEN A.key1 is not null THEN B.v1 WHEN A.key2 is not null THEN B.v2 ELSE NULL END FROM B WHERE A.ID = B.ID) {code} > Support `OuterReference` in projection list of IN correlated subqueries > ----------------------------------------------------------------------- > > Key: SPARK-18603 > URL: https://issues.apache.org/jira/browse/SPARK-18603 > Project: Spark > Issue Type: Sub-task > Components: SQL > Affects Versions: 2.0.2 > Reporter: Dongjoon Hyun > > This issue aims to allow OuterReference columns in projection lists of IN correlated subqueries. > *SIMPLE EXAMPLE* > {code} > scala> sql("CREATE TEMPORARY VIEW t1 AS SELECT * FROM VALUES 1, 2 AS t1(a)") > scala> sql("CREATE TEMPORARY VIEW t2 AS SELECT * FROM VALUES 1 AS t2(b)") > scala> sql("SELECT a FROM t1 WHERE a IN (SELECT a FROM t2)").show > {code} > *COMPLEX EXAMPLE* > {code} > SELECT * > FROM t1 > WHERE a IN (SELECT x > FROM (SELECT b, a + 1 as x, a + b as y > FROM t2) > WHERE y > 0) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org