{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/85212670","pull_request_review_id":5941192,"id":85212670,"diff_hunk":"@@ -220,4 +220,13 @@ class SparkSqlParserSuite extends PlanTest {\n \n     intercept(\"explain describe tables x\", \"Unsupported SQL statement\")\n   }\n+\n+  test(\"SPARK-18106 analyze table\") {\n+    assertEqual(\"analyze table t compute statistics\",\n+      AnalyzeTableCommand(TableIdentifier(\"t\"), noscan = false))\n+    assertEqual(\"analyze table t compute statistics noscan\",\n+      AnalyzeTableCommand(TableIdentifier(\"t\"), noscan = true))\n+    intercept(\"analyze table t compute statistics xxxx\", \"Expected `NOSCAN` instead of `xxxx`\")\n+    intercept(\"analyze table t partition (a) compute statistics xxxx\")","path":"sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala","position":22,"original_position":22,"commit_id":"2a7707e2b487e063f4658cb0bc7c97b79189a934","original_commit_id":"2a7707e2b487e063f4658cb0bc7c97b79189a934","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},"body":"Thank you. But, the parse test should be rewritten. Is it okay? Those testcase uses `assertAnalyzeCommand` using SparkSession and looks like the following.\r\n```scala\r\n    def assertAnalyzeCommand(analyzeCommand: String, c: Class[_]) {\r\n      val parsed = spark.sessionState.sqlParser.parsePlan(analyzeCommand)\r\n      val operators = parsed.collect {\r\n        case a: AnalyzeTableCommand => a\r\n        case o => o\r\n      }\r\n\r\n      assert(operators.size === 1)\r\n      if (operators(0).getClass() != c) {\r\n        fail(\r\n          s\"\"\"$analyzeCommand expected command: $c, but got ${operators(0)}\r\n             |parsed command:\r\n             |$parsed\r\n           \"\"\".stripMargin)\r\n      }\r\n    }\r\n\r\n    assertAnalyzeCommand(\r\n      \"ANALYZE TABLE Table1 COMPUTE STATISTICS\",\r\n      classOf[AnalyzeTableCommand])\r\n```","created_at":"2016-10-26T20:27:48Z","updated_at":"2016-10-26T20:27:48Z","html_url":"https://github.com/apache/spark/pull/15640#discussion_r85212670","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/15640","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/85212670"},"html":{"href":"https://github.com/apache/spark/pull/15640#discussion_r85212670"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/15640"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/15640","id":90939138,"html_url":"https://github.com/apache/spark/pull/15640","diff_url":"https://github.com/apache/spark/pull/15640.diff","patch_url":"https://github.com/apache/spark/pull/15640.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/15640","number":15640,"state":"open","locked":false,"title":"[SPARK-18106][SQL] ANALYZE TABLE should raise a ParseException for invalid option","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},"body":"## What changes were proposed in this pull request?\r\n\r\nCurrently, `ANALYZE TABLE` command accepts `identifier` for option `NOSCAN`. This PR raises a ParseException for unknown option.\r\n\r\n**Before**\r\n```scala\r\nscala> sql(\"create table test(a int)\")\r\nres0: org.apache.spark.sql.DataFrame = []\r\n\r\nscala> sql(\"analyze table test compute statistics blah\")\r\nres1: org.apache.spark.sql.DataFrame = []\r\n```\r\n\r\n**After**\r\n```scala\r\nscala> sql(\"create table test(a int)\")\r\nres0: org.apache.spark.sql.DataFrame = []\r\n\r\nscala> sql(\"analyze table test compute statistics blah\")\r\norg.apache.spark.sql.catalyst.parser.ParseException:\r\nExpected `NOSCAN` instead of `blah`(line 1, pos 0)\r\n```\r\n\r\n## How was this patch tested?\r\n\r\nPass the Jenkins test with a new test case.","created_at":"2016-10-26T05:33:57Z","updated_at":"2016-10-26T20:27:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"213f276b8627e66696b2b301715625ba1776da70","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/15640/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/15640/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/15640/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/2a7707e2b487e063f4658cb0bc7c97b79189a934","head":{"label":"dongjoon-hyun:SPARK-18106","ref":"SPARK-18106","sha":"2a7707e2b487e063f4658cb0bc7c97b79189a934","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},"repo":{"id":28900400,"name":"spark","full_name":"dongjoon-hyun/spark","owner":{"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},"private":false,"html_url":"https://github.com/dongjoon-hyun/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/dongjoon-hyun/spark","forks_url":"https://api.github.com/repos/dongjoon-hyun/spark/forks","keys_url":"https://api.github.com/repos/dongjoon-hyun/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dongjoon-hyun/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dongjoon-hyun/spark/teams","hooks_url":"https://api.github.com/repos/dongjoon-hyun/spark/hooks","issue_events_url":"https://api.github.com/repos/dongjoon-hyun/spark/issues/events{/number}","events_url":"https://api.github.com/repos/dongjoon-hyun/spark/events","assignees_url":"https://api.github.com/repos/dongjoon-hyun/spark/assignees{/user}","branches_url":"https://api.github.com/repos/dongjoon-hyun/spark/branches{/branch}","tags_url":"https://api.github.com/repos/dongjoon-hyun/spark/tags","blobs_url":"https://api.github.com/repos/dongjoon-hyun/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dongjoon-hyun/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dongjoon-hyun/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/dongjoon-hyun/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dongjoon-hyun/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/dongjoon-hyun/spark/languages","stargazers_url":"https://api.github.com/repos/dongjoon-hyun/spark/stargazers","contributors_url":"https://api.github.com/repos/dongjoon-hyun/spark/contributors","subscribers_url":"https://api.github.com/repos/dongjoon-hyun/spark/subscribers","subscription_url":"https://api.github.com/repos/dongjoon-hyun/spark/subscription","commits_url":"https://api.github.com/repos/dongjoon-hyun/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/dongjoon-hyun/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/dongjoon-hyun/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/dongjoon-hyun/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/dongjoon-hyun/spark/contents/{+path}","compare_url":"https://api.github.com/repos/dongjoon-hyun/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dongjoon-hyun/spark/merges","archive_url":"https://api.github.com/repos/dongjoon-hyun/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dongjoon-hyun/spark/downloads","issues_url":"https://api.github.com/repos/dongjoon-hyun/spark/issues{/number}","pulls_url":"https://api.github.com/repos/dongjoon-hyun/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/dongjoon-hyun/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/dongjoon-hyun/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dongjoon-hyun/spark/labels{/name}","releases_url":"https://api.github.com/repos/dongjoon-hyun/spark/releases{/id}","deployments_url":"https://api.github.com/repos/dongjoon-hyun/spark/deployments","created_at":"2015-01-07T05:46:34Z","updated_at":"2016-10-22T05:30:09Z","pushed_at":"2016-10-26T19:00:10Z","git_url":"git://github.com/dongjoon-hyun/spark.git","ssh_url":"git@github.com:dongjoon-hyun/spark.git","clone_url":"https://github.com/dongjoon-hyun/spark.git","svn_url":"https://github.com/dongjoon-hyun/spark","homepage":null,"size":240520,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"312ea3f7f65532818e11016d6d780ad47485175f","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of 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":"2016-10-26T19:32:48Z","pushed_at":"2016-10-26T20:27:11Z","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":null,"size":603462,"stargazers_count":10518,"watchers_count":10518,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9785,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":480,"forks":9785,"open_issues":480,"watchers":10518,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/15640"},"html":{"href":"https://github.com/apache/spark/pull/15640"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/15640"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/15640/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/15640/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/15640/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/2a7707e2b487e063f4658cb0bc7c97b79189a934"}}}}
{"actor":{"display_login":"dongjoon-hyun"}}