{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/350384426","pull_request_review_id":322531761,"id":350384426,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM1MDM4NDQyNg==","diff_hunk":"@@ -1669,6 +1669,105 @@ class DDLParserSuite extends AnalysisTest {\n     comparePlans(parsed, expected)\n   }\n \n+  test(\"create view -- basic\") {\n+    val v1 = \"CREATE VIEW view1 AS SELECT * FROM tab1\"\n+    val parsed1 = parsePlan(v1)\n+\n+    val expected1 = CreateViewStatement(\n+      Seq(\"view1\"),\n+      Seq.empty[(String, Option[String])],\n+      None,\n+      Map.empty[String, String],\n+      Some(\"SELECT * FROM tab1\"),\n+      parsePlan(\"SELECT * FROM tab1\"),\n+      false,\n+      false,\n+      PersistedView)\n+    comparePlans(parsed1, expected1)\n+\n+    val v2 = \"CREATE VIEW a.b.c AS SELECT * FROM tab1\"\n+    val parsed2 = parsePlan(v2)\n+\n+    val expected2 = CreateViewStatement(\n+      Seq(\"a\", \"b\", \"c\"),\n+      Seq.empty[(String, Option[String])],\n+      None,\n+      Map.empty[String, String],\n+      Some(\"SELECT * FROM tab1\"),\n+      parsePlan(\"SELECT * FROM tab1\"),\n+      false,\n+      false,\n+      PersistedView)\n+    comparePlans(parsed2, expected2)\n+  }\n+\n+  test(\"create view - full\") {\n+    val v1 =\n+      \"\"\"\n+        |CREATE OR REPLACE VIEW view1\n+        |(col1, col3 COMMENT 'hello')\n+        |TBLPROPERTIES('prop1Key'=\"prop1Val\")\n+        |COMMENT 'BLABLA'\n+        |AS SELECT * FROM tab1\n+      \"\"\".stripMargin\n+    val parsed1 = parsePlan(v1)\n+    val expected1 = CreateViewStatement(\n+      Seq(\"view1\"),\n+      Seq(\"col1\" -> None, \"col3\" -> Some(\"hello\")),\n+      Some(\"BLABLA\"),\n+      Map(\"prop1Key\" -> \"prop1Val\"),\n+      Some(\"SELECT * FROM tab1\"),\n+      parsePlan(\"SELECT * FROM tab1\"),\n+      false,\n+      true,\n+      PersistedView)\n+    comparePlans(parsed1, expected1)\n+\n+    val v2 =\n+      \"\"\"\n+        |CREATE OR REPLACE VIEW a.b.c\n+        |(col1, col3 COMMENT 'hello')\n+        |TBLPROPERTIES('prop1Key'=\"prop1Val\")\n+        |COMMENT 'BLABLA'\n+        |AS SELECT * FROM tab1\n+      \"\"\".stripMargin\n+    val parsed2 = parsePlan(v2)\n+    val expected2 = CreateViewStatement(\n+      Seq(\"a\", \"b\", \"c\"),\n+      Seq(\"col1\" -> None, \"col3\" -> Some(\"hello\")),\n+      Some(\"BLABLA\"),\n+      Map(\"prop1Key\" -> \"prop1Val\"),\n+      Some(\"SELECT * FROM tab1\"),\n+      parsePlan(\"SELECT * FROM tab1\"),\n+      false,\n+      true,\n+      PersistedView)","path":"sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/DDLParserSuite.scala","position":85,"original_position":85,"commit_id":"65b09be7da2948acbda0b64afcdb873286233cf7","original_commit_id":"65b09be7da2948acbda0b64afcdb873286233cf7","user":{"login":"viirya","id":68855,"node_id":"MDQ6VXNlcjY4ODU1","avatar_url":"https://avatars1.githubusercontent.com/u/68855?v=4","gravatar_id":"","url":"https://api.github.com/users/viirya","html_url":"https://github.com/viirya","followers_url":"https://api.github.com/users/viirya/followers","following_url":"https://api.github.com/users/viirya/following{/other_user}","gists_url":"https://api.github.com/users/viirya/gists{/gist_id}","starred_url":"https://api.github.com/users/viirya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viirya/subscriptions","organizations_url":"https://api.github.com/users/viirya/orgs","repos_url":"https://api.github.com/users/viirya/repos","events_url":"https://api.github.com/users/viirya/events{/privacy}","received_events_url":"https://api.github.com/users/viirya/received_events","type":"User","site_admin":false},"body":"these tests are all for PersistedView, can we have few for other view types?","created_at":"2019-11-25T19:42:14Z","updated_at":"2019-11-25T19:42:14Z","html_url":"https://github.com/apache/spark/pull/26649#discussion_r350384426","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/26649","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/350384426"},"html":{"href":"https://github.com/apache/spark/pull/26649#discussion_r350384426"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/26649"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/26649","id":344870961,"node_id":"MDExOlB1bGxSZXF1ZXN0MzQ0ODcwOTYx","html_url":"https://github.com/apache/spark/pull/26649","diff_url":"https://github.com/apache/spark/pull/26649.diff","patch_url":"https://github.com/apache/spark/pull/26649.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/26649","number":26649,"state":"open","locked":false,"title":"[SPARK-29862][SQL] CREATE (OR REPLACE) ... VIEW should look up catalog/table like v2 commands","user":{"login":"huaxingao","id":13592258,"node_id":"MDQ6VXNlcjEzNTkyMjU4","avatar_url":"https://avatars3.githubusercontent.com/u/13592258?v=4","gravatar_id":"","url":"https://api.github.com/users/huaxingao","html_url":"https://github.com/huaxingao","followers_url":"https://api.github.com/users/huaxingao/followers","following_url":"https://api.github.com/users/huaxingao/following{/other_user}","gists_url":"https://api.github.com/users/huaxingao/gists{/gist_id}","starred_url":"https://api.github.com/users/huaxingao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huaxingao/subscriptions","organizations_url":"https://api.github.com/users/huaxingao/orgs","repos_url":"https://api.github.com/users/huaxingao/repos","events_url":"https://api.github.com/users/huaxingao/events{/privacy}","received_events_url":"https://api.github.com/users/huaxingao/received_events","type":"User","site_admin":false},"body":"### What changes were proposed in this pull request?\r\nAdd CreateViewStatement and make CREARE VIEW  go through the same catalog/table resolution framework of v2 commands.\r\n\r\n### Why are the changes needed?\r\nIt's important to make all the commands have the same table resolution behavior, to avoid confusing end-users. e.g.\r\n```\r\nUSE my_catalog\r\nDESC v // success and describe the view v from my_catalog\r\nCREATE VIEW v AS SELECT 1 // report view not found as there is no view v in the session catalog\r\n```\r\n### Does this PR introduce any user-facing change?\r\nYes. When running CREATE VIEW ...  Spark fails the command if the current catalog is set to a v2 catalog, or the view name specified a v2 catalog.\r\n\r\n\r\n### How was this patch tested?\r\nunit tests\r\n","created_at":"2019-11-24T04:10:58Z","updated_at":"2019-11-25T19:42:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bc352b56122c29d57fc1b3e8e673422daf7ffd4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1405794576,"node_id":"MDU6TGFiZWwxNDA1Nzk0NTc2","url":"https://api.github.com/repos/apache/spark/labels/SQL","name":"SQL","color":"ededed","default":false,"description":null}],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/26649/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/26649/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/26649/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/65b09be7da2948acbda0b64afcdb873286233cf7","head":{"label":"huaxingao:spark-29862","ref":"spark-29862","sha":"65b09be7da2948acbda0b64afcdb873286233cf7","user":{"login":"huaxingao","id":13592258,"node_id":"MDQ6VXNlcjEzNTkyMjU4","avatar_url":"https://avatars3.githubusercontent.com/u/13592258?v=4","gravatar_id":"","url":"https://api.github.com/users/huaxingao","html_url":"https://github.com/huaxingao","followers_url":"https://api.github.com/users/huaxingao/followers","following_url":"https://api.github.com/users/huaxingao/following{/other_user}","gists_url":"https://api.github.com/users/huaxingao/gists{/gist_id}","starred_url":"https://api.github.com/users/huaxingao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huaxingao/subscriptions","organizations_url":"https://api.github.com/users/huaxingao/orgs","repos_url":"https://api.github.com/users/huaxingao/repos","events_url":"https://api.github.com/users/huaxingao/events{/privacy}","received_events_url":"https://api.github.com/users/huaxingao/received_events","type":"User","site_admin":false},"repo":{"id":50813048,"node_id":"MDEwOlJlcG9zaXRvcnk1MDgxMzA0OA==","name":"spark","full_name":"huaxingao/spark","private":false,"owner":{"login":"huaxingao","id":13592258,"node_id":"MDQ6VXNlcjEzNTkyMjU4","avatar_url":"https://avatars3.githubusercontent.com/u/13592258?v=4","gravatar_id":"","url":"https://api.github.com/users/huaxingao","html_url":"https://github.com/huaxingao","followers_url":"https://api.github.com/users/huaxingao/followers","following_url":"https://api.github.com/users/huaxingao/following{/other_user}","gists_url":"https://api.github.com/users/huaxingao/gists{/gist_id}","starred_url":"https://api.github.com/users/huaxingao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huaxingao/subscriptions","organizations_url":"https://api.github.com/users/huaxingao/orgs","repos_url":"https://api.github.com/users/huaxingao/repos","events_url":"https://api.github.com/users/huaxingao/events{/privacy}","received_events_url":"https://api.github.com/users/huaxingao/received_events","type":"User","site_admin":false},"html_url":"https://github.com/huaxingao/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/huaxingao/spark","forks_url":"https://api.github.com/repos/huaxingao/spark/forks","keys_url":"https://api.github.com/repos/huaxingao/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huaxingao/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huaxingao/spark/teams","hooks_url":"https://api.github.com/repos/huaxingao/spark/hooks","issue_events_url":"https://api.github.com/repos/huaxingao/spark/issues/events{/number}","events_url":"https://api.github.com/repos/huaxingao/spark/events","assignees_url":"https://api.github.com/repos/huaxingao/spark/assignees{/user}","branches_url":"https://api.github.com/repos/huaxingao/spark/branches{/branch}","tags_url":"https://api.github.com/repos/huaxingao/spark/tags","blobs_url":"https://api.github.com/repos/huaxingao/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huaxingao/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huaxingao/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/huaxingao/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huaxingao/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/huaxingao/spark/languages","stargazers_url":"https://api.github.com/repos/huaxingao/spark/stargazers","contributors_url":"https://api.github.com/repos/huaxingao/spark/contributors","subscribers_url":"https://api.github.com/repos/huaxingao/spark/subscribers","subscription_url":"https://api.github.com/repos/huaxingao/spark/subscription","commits_url":"https://api.github.com/repos/huaxingao/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/huaxingao/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/huaxingao/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/huaxingao/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/huaxingao/spark/contents/{+path}","compare_url":"https://api.github.com/repos/huaxingao/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huaxingao/spark/merges","archive_url":"https://api.github.com/repos/huaxingao/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huaxingao/spark/downloads","issues_url":"https://api.github.com/repos/huaxingao/spark/issues{/number}","pulls_url":"https://api.github.com/repos/huaxingao/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/huaxingao/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/huaxingao/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huaxingao/spark/labels{/name}","releases_url":"https://api.github.com/repos/huaxingao/spark/releases{/id}","deployments_url":"https://api.github.com/repos/huaxingao/spark/deployments","created_at":"2016-02-01T04:09:11Z","updated_at":"2019-11-05T02:21:55Z","pushed_at":"2019-11-25T18:16:14Z","git_url":"git://github.com/huaxingao/spark.git","ssh_url":"git@github.com:huaxingao/spark.git","clone_url":"https://github.com/huaxingao/spark.git","svn_url":"https://github.com/huaxingao/spark","homepage":null,"size":303208,"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":"13338eaa9509fa526438067aeb4cd41f4048931a","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-25T19:41:24Z","pushed_at":"2019-11-25T19:36:07Z","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":319213,"stargazers_count":24350,"watchers_count":24350,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20608,"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":20608,"open_issues":486,"watchers":24350,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/26649"},"html":{"href":"https://github.com/apache/spark/pull/26649"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/26649"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/26649/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/26649/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/26649/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/65b09be7da2948acbda0b64afcdb873286233cf7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"viirya"}}