{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/345838603","pull_request_review_id":316348275,"id":345838603,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM0NTgzODYwMw==","diff_hunk":"@@ -110,19 +110,25 @@ case class CreateViewCommand(\n \n   private def isTemporary = viewType == LocalTempView || viewType == GlobalTempView\n \n-  // Disallows 'CREATE TEMPORARY VIEW IF NOT EXISTS' to be consistent with 'CREATE TEMPORARY TABLE'\n-  if (allowExisting && isTemporary) {\n-    throw new AnalysisException(\n-      \"It is not allowed to define a TEMPORARY view with IF NOT EXISTS.\")\n-  }\n+  if (isTemporary) verifyTempView()\n+\n+  private def verifyTempView(): Unit = {\n+    // Disallows 'CREATE TEMPORARY VIEW IF NOT EXISTS'\n+    // to be consistent with 'CREATE TEMPORARY TABLE'\n+    if (allowExisting) {","path":"sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala","position":23,"original_position":23,"commit_id":"3f12e09c287c1daa0d7b630d8fb218a1d1bc3cbb","original_commit_id":"3f12e09c287c1daa0d7b630d8fb218a1d1bc3cbb","user":{"login":"amanomer","id":40591404,"node_id":"MDQ6VXNlcjQwNTkxNDA0","avatar_url":"https://avatars1.githubusercontent.com/u/40591404?v=4","gravatar_id":"","url":"https://api.github.com/users/amanomer","html_url":"https://github.com/amanomer","followers_url":"https://api.github.com/users/amanomer/followers","following_url":"https://api.github.com/users/amanomer/following{/other_user}","gists_url":"https://api.github.com/users/amanomer/gists{/gist_id}","starred_url":"https://api.github.com/users/amanomer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amanomer/subscriptions","organizations_url":"https://api.github.com/users/amanomer/orgs","repos_url":"https://api.github.com/users/amanomer/repos","events_url":"https://api.github.com/users/amanomer/events{/privacy}","received_events_url":"https://api.github.com/users/amanomer/received_events","type":"User","site_admin":false},"body":"Postgres doesn't allow using 'IF NOT EXISTS' while creating view. \r\nhttps://www.postgresql.org/docs/9.2/sql-createview.html","created_at":"2019-11-13T15:50:27Z","updated_at":"2019-11-13T15:50:27Z","html_url":"https://github.com/apache/spark/pull/26317#discussion_r345838603","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/26317","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/345838603"},"html":{"href":"https://github.com/apache/spark/pull/26317#discussion_r345838603"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/26317"}},"in_reply_to_id":345743870},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/26317","id":334103830,"node_id":"MDExOlB1bGxSZXF1ZXN0MzM0MTAzODMw","html_url":"https://github.com/apache/spark/pull/26317","diff_url":"https://github.com/apache/spark/pull/26317.diff","patch_url":"https://github.com/apache/spark/pull/26317.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/26317","number":26317,"state":"open","locked":false,"title":"[SPARK-29628][SQL] Forcibly create a temporary view in CREATE VIEW if referencing a temporary view","user":{"login":"amanomer","id":40591404,"node_id":"MDQ6VXNlcjQwNTkxNDA0","avatar_url":"https://avatars1.githubusercontent.com/u/40591404?v=4","gravatar_id":"","url":"https://api.github.com/users/amanomer","html_url":"https://github.com/amanomer","followers_url":"https://api.github.com/users/amanomer/followers","following_url":"https://api.github.com/users/amanomer/following{/other_user}","gists_url":"https://api.github.com/users/amanomer/gists{/gist_id}","starred_url":"https://api.github.com/users/amanomer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amanomer/subscriptions","organizations_url":"https://api.github.com/users/amanomer/orgs","repos_url":"https://api.github.com/users/amanomer/repos","events_url":"https://api.github.com/users/amanomer/events{/privacy}","received_events_url":"https://api.github.com/users/amanomer/received_events","type":"User","site_admin":false},"body":"<!--\r\nThanks for sending a pull request!  Here are some tips for you:\r\n  1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html\r\n  2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html\r\n  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.\r\n  4. Be sure to keep the PR description updated to reflect all changes.\r\n  5. Please write your PR title to summarize what this PR proposes.\r\n  6. If possible, provide a concise example to reproduce the issue for a faster review.\r\n-->\r\n\r\n### What changes were proposed in this pull request?\r\nWhen creating permanent view based on temporary view, it will be created as a temporary view. Previously, Spark this was not allowed.\r\n<!--\r\nPlease clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. \r\nIf possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.\r\n  1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.\r\n  2. If you fix some SQL features, you can provide some references of other DBMSes.\r\n  3. If there is design documentation, please add the link.\r\n  4. If there is a discussion in the mailing list, please add the link.\r\n-->\r\n\r\n\r\n### Why are the changes needed?\r\nTo match the behavior of postgreSQL.\r\n<!--\r\nPlease clarify why the changes are needed. For instance,\r\n  1. If you propose a new API, clarify the use case for a new API.\r\n  2. If you fix a bug, you can clarify why it is a bug.\r\n-->\r\n\r\n\r\n### Does this PR introduce any user-facing change?\r\nNo\r\n<!--\r\nIf yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.\r\nIf no, write 'No'.\r\n-->\r\n\r\n\r\n### How was this patch tested?\r\nUT added.\r\n<!--\r\nIf tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.\r\nIf it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.\r\nIf tests were not added, please describe why they were not added and/or why it was difficult to add.\r\n-->\r\n","created_at":"2019-10-30T08:57:38Z","updated_at":"2019-11-13T15:50:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b9da62bdea224a40dab1d7bfdb13c16f7b455613","assignee":null,"assignees":[],"requested_reviewers":[{"login":"maropu","id":692303,"node_id":"MDQ6VXNlcjY5MjMwMw==","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},{"login":"dongjoon-hyun","id":9700541,"node_id":"MDQ6VXNlcjk3MDA1NDE=","avatar_url":"https://avatars2.githubusercontent.com/u/9700541?v=4","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}],"requested_teams":[],"labels":[{"id":1405794576,"node_id":"MDU6TGFiZWwxNDA1Nzk0NTc2","url":"https://api.github.com/repos/apache/spark/labels/SQL","name":"SQL","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/26317/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/26317/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/26317/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/3f12e09c287c1daa0d7b630d8fb218a1d1bc3cbb","head":{"label":"amanomer:29628","ref":"29628","sha":"3f12e09c287c1daa0d7b630d8fb218a1d1bc3cbb","user":{"login":"amanomer","id":40591404,"node_id":"MDQ6VXNlcjQwNTkxNDA0","avatar_url":"https://avatars1.githubusercontent.com/u/40591404?v=4","gravatar_id":"","url":"https://api.github.com/users/amanomer","html_url":"https://github.com/amanomer","followers_url":"https://api.github.com/users/amanomer/followers","following_url":"https://api.github.com/users/amanomer/following{/other_user}","gists_url":"https://api.github.com/users/amanomer/gists{/gist_id}","starred_url":"https://api.github.com/users/amanomer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amanomer/subscriptions","organizations_url":"https://api.github.com/users/amanomer/orgs","repos_url":"https://api.github.com/users/amanomer/repos","events_url":"https://api.github.com/users/amanomer/events{/privacy}","received_events_url":"https://api.github.com/users/amanomer/received_events","type":"User","site_admin":false},"repo":{"id":203616393,"node_id":"MDEwOlJlcG9zaXRvcnkyMDM2MTYzOTM=","name":"spark","full_name":"amanomer/spark","private":false,"owner":{"login":"amanomer","id":40591404,"node_id":"MDQ6VXNlcjQwNTkxNDA0","avatar_url":"https://avatars1.githubusercontent.com/u/40591404?v=4","gravatar_id":"","url":"https://api.github.com/users/amanomer","html_url":"https://github.com/amanomer","followers_url":"https://api.github.com/users/amanomer/followers","following_url":"https://api.github.com/users/amanomer/following{/other_user}","gists_url":"https://api.github.com/users/amanomer/gists{/gist_id}","starred_url":"https://api.github.com/users/amanomer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amanomer/subscriptions","organizations_url":"https://api.github.com/users/amanomer/orgs","repos_url":"https://api.github.com/users/amanomer/repos","events_url":"https://api.github.com/users/amanomer/events{/privacy}","received_events_url":"https://api.github.com/users/amanomer/received_events","type":"User","site_admin":false},"html_url":"https://github.com/amanomer/spark","description":"Apache Spark","fork":true,"url":"https://api.github.com/repos/amanomer/spark","forks_url":"https://api.github.com/repos/amanomer/spark/forks","keys_url":"https://api.github.com/repos/amanomer/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amanomer/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amanomer/spark/teams","hooks_url":"https://api.github.com/repos/amanomer/spark/hooks","issue_events_url":"https://api.github.com/repos/amanomer/spark/issues/events{/number}","events_url":"https://api.github.com/repos/amanomer/spark/events","assignees_url":"https://api.github.com/repos/amanomer/spark/assignees{/user}","branches_url":"https://api.github.com/repos/amanomer/spark/branches{/branch}","tags_url":"https://api.github.com/repos/amanomer/spark/tags","blobs_url":"https://api.github.com/repos/amanomer/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amanomer/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amanomer/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/amanomer/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amanomer/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/amanomer/spark/languages","stargazers_url":"https://api.github.com/repos/amanomer/spark/stargazers","contributors_url":"https://api.github.com/repos/amanomer/spark/contributors","subscribers_url":"https://api.github.com/repos/amanomer/spark/subscribers","subscription_url":"https://api.github.com/repos/amanomer/spark/subscription","commits_url":"https://api.github.com/repos/amanomer/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/amanomer/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/amanomer/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/amanomer/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/amanomer/spark/contents/{+path}","compare_url":"https://api.github.com/repos/amanomer/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amanomer/spark/merges","archive_url":"https://api.github.com/repos/amanomer/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amanomer/spark/downloads","issues_url":"https://api.github.com/repos/amanomer/spark/issues{/number}","pulls_url":"https://api.github.com/repos/amanomer/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/amanomer/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/amanomer/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amanomer/spark/labels{/name}","releases_url":"https://api.github.com/repos/amanomer/spark/releases{/id}","deployments_url":"https://api.github.com/repos/amanomer/spark/deployments","created_at":"2019-08-21T15:46:46Z","updated_at":"2019-08-23T17:28:10Z","pushed_at":"2019-11-13T05:53:51Z","git_url":"git://github.com/amanomer/spark.git","ssh_url":"git@github.com:amanomer/spark.git","clone_url":"https://github.com/amanomer/spark.git","svn_url":"https://github.com/amanomer/spark","homepage":"","size":317891,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"4de7131cffac39dca749d58b306264ad9ed9e428","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"node_id":"MDEwOlJlcG9zaXRvcnkxNzE2NTY1OA==","name":"spark","full_name":"apache/spark","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/spark","description":"Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2019-11-13T15:26:45Z","pushed_at":"2019-11-13T15:27:38Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":"","size":318186,"stargazers_count":24214,"watchers_count":24214,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20513,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":486,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":20513,"open_issues":486,"watchers":24214,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/26317"},"html":{"href":"https://github.com/apache/spark/pull/26317"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/26317"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/26317/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/26317/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/26317/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/3f12e09c287c1daa0d7b630d8fb218a1d1bc3cbb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"amanomer"}}