{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/18938","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/18938/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/18938/comments","events_url":"https://api.github.com/repos/apache/spark/issues/18938/events","html_url":"https://github.com/apache/spark/pull/18938","id":249977095,"number":18938,"title":"[SPARK-21363][SQL] Prevent name duplication in (global/local) temporary views","user":{"login":"maropu","id":692303,"avatar_url":"https://avatars3.githubusercontent.com/u/692303?v=4","gravatar_id":"","url":"https://api.github.com/users/maropu","html_url":"https://github.com/maropu","followers_url":"https://api.github.com/users/maropu/followers","following_url":"https://api.github.com/users/maropu/following{/other_user}","gists_url":"https://api.github.com/users/maropu/gists{/gist_id}","starred_url":"https://api.github.com/users/maropu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maropu/subscriptions","organizations_url":"https://api.github.com/users/maropu/orgs","repos_url":"https://api.github.com/users/maropu/repos","events_url":"https://api.github.com/users/maropu/events{/privacy}","received_events_url":"https://api.github.com/users/maropu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-08-14T09:27:06Z","updated_at":"2017-08-15T06:00:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/18938","html_url":"https://github.com/apache/spark/pull/18938","diff_url":"https://github.com/apache/spark/pull/18938.diff","patch_url":"https://github.com/apache/spark/pull/18938.patch"},"body":"## What changes were proposed in this pull request?\r\nThis pr prevented name duplication in (global/local) temporary views. Currently, the master only prevents the duplication in permanent views, for example:\r\n```\r\n// Permanent view case\r\nscala> sql(\"CREATE VIEW t AS SELECT * FROM VALUES (1, 2), (2, 3) t(a, a)\")\r\norg.apache.spark.sql.AnalysisException: Found duplicate column(s) in the view definition: `a`;\r\n\r\nscala> sql(\"CREATE VIEW t AS SELECT * FROM VALUES (1, 2), (2, 3) t(a, b)\")\r\nscala> sql(\"SELECT * FROM t\").show\r\n+---+---+\r\n|  a|  b|\r\n+---+---+\r\n|  1|  2|\r\n|  2|  3|\r\n+---+---+\r\n\r\nscala> sql(\"ALTER VIEW t AS SELECT * FROM VALUES (4, 5), (5, 6) t(b, b)\")\r\norg.apache.spark.sql.AnalysisException: Found duplicate column(s) in the view definition: `b`;\r\n\r\n// Local temporary view case\r\nscala> sql(\"CREATE TEMPORARY VIEW t AS SELECT * FROM VALUES (1, 2), (2, 3) t(a, a)\")\r\nscala> sql(\"SELECT * FROM t\").show\r\n+---+---+\r\n|  a|  a|\r\n+---+---+\r\n|  1|  2|\r\n|  2|  3|\r\n+---+---+\r\n\r\nscala> sql(\"ALTER VIEW t AS SELECT * FROM VALUES (4, 5), (5, 6) t(b, b)\")\r\nscala> sql(\"SELECT * FROM t\").show\r\n+---+---+\r\n|  b|  b|\r\n+---+---+\r\n|  4|  5|\r\n|  5|  6|\r\n+---+---+\r\n\r\n// Global temporary view case\r\nscala> sql(\"CREATE GLOBAL TEMPORARY VIEW t AS SELECT * FROM VALUES (1, 2), (2, 3) t(a, a)\")\r\nscala> sql(\"SELECT * FROM global_temp.t\").show\r\n+---+---+\r\n|  a|  a|\r\n+---+---+\r\n|  1|  2|\r\n|  2|  3|\r\n+---+---+\r\n\r\nscala> sql(\"ALTER VIEW t AS SELECT * FROM VALUES (4, 5), (5, 6) t(b, b)\")\r\nscala> sql(\"SELECT * FROM t\").show\r\n+---+---+\r\n|  b|  b|\r\n+---+---+\r\n|  4|  5|\r\n|  5|  6|\r\n+---+---+\r\n```\r\nThis is a follow-up of SPARK-21363 though, this pr changed the existing behaviour.\r\n\r\n## How was this patch tested?\r\nModified the existing tests in `DDLSuite`.\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/322384069","html_url":"https://github.com/apache/spark/pull/18938#issuecomment-322384069","issue_url":"https://api.github.com/repos/apache/spark/issues/18938","id":322384069,"user":{"login":"maropu","id":692303,"avatar_url":"https://avatars3.githubusercontent.com/u/692303?v=4","gravatar_id":"","url":"https://api.github.com/users/maropu","html_url":"https://github.com/maropu","followers_url":"https://api.github.com/users/maropu/followers","following_url":"https://api.github.com/users/maropu/following{/other_user}","gists_url":"https://api.github.com/users/maropu/gists{/gist_id}","starred_url":"https://api.github.com/users/maropu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maropu/subscriptions","organizations_url":"https://api.github.com/users/maropu/orgs","repos_url":"https://api.github.com/users/maropu/repos","events_url":"https://api.github.com/users/maropu/events{/privacy}","received_events_url":"https://api.github.com/users/maropu/received_events","type":"User","site_admin":false},"created_at":"2017-08-15T06:00:45Z","updated_at":"2017-08-15T06:00:45Z","body":"We still support this for 3.x releases? If so, I'll close jira as \"Won't fix\"."}}
{"actor":{"display_login":"maropu"}}