{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/16015","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/16015/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/16015/comments","events_url":"https://api.github.com/repos/apache/spark/issues/16015/events","html_url":"https://github.com/apache/spark/pull/16015","id":191784466,"number":16015,"title":"[SPARK-17251][SQL] Improve `OuterReference` to be `NamedExpression`","user":{"login":"dongjoon-hyun","id":9700541,"avatar_url":"https://avatars.githubusercontent.com/u/9700541?v=3","gravatar_id":"","url":"https://api.github.com/users/dongjoon-hyun","html_url":"https://github.com/dongjoon-hyun","followers_url":"https://api.github.com/users/dongjoon-hyun/followers","following_url":"https://api.github.com/users/dongjoon-hyun/following{/other_user}","gists_url":"https://api.github.com/users/dongjoon-hyun/gists{/gist_id}","starred_url":"https://api.github.com/users/dongjoon-hyun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dongjoon-hyun/subscriptions","organizations_url":"https://api.github.com/users/dongjoon-hyun/orgs","repos_url":"https://api.github.com/users/dongjoon-hyun/repos","events_url":"https://api.github.com/users/dongjoon-hyun/events{/privacy}","received_events_url":"https://api.github.com/users/dongjoon-hyun/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-26T03:33:05Z","updated_at":"2016-11-26T06:47:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/16015","html_url":"https://github.com/apache/spark/pull/16015","diff_url":"https://github.com/apache/spark/pull/16015.diff","patch_url":"https://github.com/apache/spark/pull/16015.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nCurrently, `OuterReference` is not `NamedExpression`. So, it raises 'ClassCastException` when it used in projection lists of IN correlated subqueries. This PR aims to support that by making `OuterReference` as `NamedExpression` to show correct error messages.\r\n\r\n```scala\r\nscala> sql(\"CREATE TEMPORARY VIEW t1 AS SELECT * FROM VALUES 1, 2 AS t1(a)\")\r\nscala> sql(\"CREATE TEMPORARY VIEW t2 AS SELECT * FROM VALUES 1 AS t2(b)\")\r\nscala> sql(\"SELECT a FROM t1 WHERE a IN (SELECT a FROM t2)\").show\r\njava.lang.ClassCastException: org.apache.spark.sql.catalyst.expressions.OuterReference cannot be cast to org.apache.spark.sql.catalyst.expressions.NamedExpression\r\n```\r\n\r\n## How was this patch tested?\r\n\r\nPass the Jenkins test with new test cases."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/263047858","html_url":"https://github.com/apache/spark/pull/16015#issuecomment-263047858","issue_url":"https://api.github.com/repos/apache/spark/issues/16015","id":263047858,"user":{"login":"SparkQA","id":8108735,"avatar_url":"https://avatars.githubusercontent.com/u/8108735?v=3","gravatar_id":"","url":"https://api.github.com/users/SparkQA","html_url":"https://github.com/SparkQA","followers_url":"https://api.github.com/users/SparkQA/followers","following_url":"https://api.github.com/users/SparkQA/following{/other_user}","gists_url":"https://api.github.com/users/SparkQA/gists{/gist_id}","starred_url":"https://api.github.com/users/SparkQA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SparkQA/subscriptions","organizations_url":"https://api.github.com/users/SparkQA/orgs","repos_url":"https://api.github.com/users/SparkQA/repos","events_url":"https://api.github.com/users/SparkQA/events{/privacy}","received_events_url":"https://api.github.com/users/SparkQA/received_events","type":"User","site_admin":false},"created_at":"2016-11-26T06:47:30Z","updated_at":"2016-11-26T06:47:30Z","body":"**[Test build #69181 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/69181/consoleFull)** for PR 16015 at commit [`9d965e7`](https://github.com/apache/spark/commit/9d965e74be85dcb1ae75ee102ee63a15c411a4d8)."}}
{"actor":{"display_login":"SparkQA"}}