{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/89906448","pull_request_review_id":10436000,"id":89906448,"diff_hunk":"@@ -730,6 +730,23 @@ class SessionCatalog(\n   }\n \n   /**\n+   * List the names of all partitions that belong to the specified table, assuming it exists.\n+   *\n+   * A partial partition spec may optionally be provided to filter the partitions returned.\n+   * For instance, if there exist partitions (a='1', b='2'), (a='1', b='3') and (a='2', b='4'),\n+   * then a partial spec of (a='1') will return the first two only.\n+   */\n+  def listPartitionNames(\n+      tableName: TableIdentifier,\n+      partialSpec: Option[TablePartitionSpec] = None): Seq[String] = {\n+    val db = formatDatabaseName(tableName.database.getOrElse(getCurrentDatabase))\n+    val table = formatTableName(tableName.table)\n+    requireDbExists(db)\n+    requireTableExists(TableIdentifier(table, Option(db)))","path":"sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala","position":16,"original_position":16,"commit_id":"594c6934c4fe4e41a895ea91b3b2cc45f38eaeb6","original_commit_id":"594c6934c4fe4e41a895ea91b3b2cc45f38eaeb6","user":{"login":"gatorsmile","id":11567269,"avatar_url":"https://avatars.githubusercontent.com/u/11567269?v=3","gravatar_id":"","url":"https://api.github.com/users/gatorsmile","html_url":"https://github.com/gatorsmile","followers_url":"https://api.github.com/users/gatorsmile/followers","following_url":"https://api.github.com/users/gatorsmile/following{/other_user}","gists_url":"https://api.github.com/users/gatorsmile/gists{/gist_id}","starred_url":"https://api.github.com/users/gatorsmile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gatorsmile/subscriptions","organizations_url":"https://api.github.com/users/gatorsmile/orgs","repos_url":"https://api.github.com/users/gatorsmile/repos","events_url":"https://api.github.com/users/gatorsmile/events{/privacy}","received_events_url":"https://api.github.com/users/gatorsmile/received_events","type":"User","site_admin":false},"body":"Without `requirePartialMatchedPartitionSpec`, do we detect these negative cases?","created_at":"2016-11-28T23:05:41Z","updated_at":"2016-11-28T23:05:41Z","html_url":"https://github.com/apache/spark/pull/15998#discussion_r89906448","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/15998","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/89906448"},"html":{"href":"https://github.com/apache/spark/pull/15998#discussion_r89906448"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/15998"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/15998","id":95088711,"html_url":"https://github.com/apache/spark/pull/15998","diff_url":"https://github.com/apache/spark/pull/15998.diff","patch_url":"https://github.com/apache/spark/pull/15998.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/15998","number":15998,"state":"open","locked":false,"title":"[SPARK-18572][SQL] Add a method `listPartitionNames` to `ExternalCatalog`","user":{"login":"mallman","id":833693,"avatar_url":"https://avatars.githubusercontent.com/u/833693?v=3","gravatar_id":"","url":"https://api.github.com/users/mallman","html_url":"https://github.com/mallman","followers_url":"https://api.github.com/users/mallman/followers","following_url":"https://api.github.com/users/mallman/following{/other_user}","gists_url":"https://api.github.com/users/mallman/gists{/gist_id}","starred_url":"https://api.github.com/users/mallman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mallman/subscriptions","organizations_url":"https://api.github.com/users/mallman/orgs","repos_url":"https://api.github.com/users/mallman/repos","events_url":"https://api.github.com/users/mallman/events{/privacy}","received_events_url":"https://api.github.com/users/mallman/received_events","type":"User","site_admin":false},"body":"(Link to Jira issue: https://issues.apache.org/jira/browse/SPARK-18572)\r\n\r\n## What changes were proposed in this pull request?\r\n\r\nCurrently Spark answers the `SHOW PARTITIONS` command by fetching all of the table's partition metadata from the external catalog and constructing partition names therefrom. The Hive client has a `getPartitionNames` method which is many times faster for this purpose, with the performance improvement scaling with the number of partitions in a table.\r\n\r\nTo test the performance impact of this PR, I ran the `SHOW PARTITIONS` command on two Hive tables with large numbers of partitions. One table has ~17,800 partitions, and the other has ~95,000 partitions. For the purposes of this PR, I'll call the former table `table1` and the latter table `table2`. I ran 5 trials for each table with before-and-after versions of this PR. The results are as follows:\r\n\r\nSpark at bdc8153, `SHOW PARTITIONS table1`, times in seconds:\r\n7.901\r\n3.983\r\n4.018\r\n4.331\r\n4.261\r\n\r\nSpark at bdc8153, `SHOW PARTITIONS table2`\r\n(Timed out after 10 minutes with a `SocketTimeoutException`.)\r\n\r\nSpark at this PR, `SHOW PARTITIONS table1`, times in seconds:\r\n3.801\r\n0.449\r\n0.395\r\n0.348\r\n0.336\r\n\r\nSpark at this PR, `SHOW PARTITIONS table2`, times in seconds:\r\n5.184\r\n1.63\r\n1.474\r\n1.519\r\n1.41\r\n\r\nTaking the best times from each trial, we get a 12x performance improvement for a table with ~17,800 partitions and at least a 426x improvement for a table with ~95,000 partitions. More significantly, the latter command doesn't even complete with the current code in master.\r\n\r\nThis is actually a patch we've been using in-house at VideoAmp since Spark 1.1. It's made all the difference in the practical usability of our largest tables. Even with tables with about 1,000 partitions there's a performance improvement of about 2-3x.\r\n\r\n## How was this patch tested?\r\n\r\nI added a unit test to `VersionsSuite` which tests that the Hive client's `getPartitionNames` method returns the correct number of partitions.","created_at":"2016-11-23T22:21:57Z","updated_at":"2016-11-28T23:05:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55e222e3377f30f8cb6fc4566300589127ac69c9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/15998/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/15998/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/15998/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/594c6934c4fe4e41a895ea91b3b2cc45f38eaeb6","head":{"label":"VideoAmp:spark-18572-list_partition_names","ref":"spark-18572-list_partition_names","sha":"594c6934c4fe4e41a895ea91b3b2cc45f38eaeb6","user":{"login":"VideoAmp","id":7621972,"avatar_url":"https://avatars.githubusercontent.com/u/7621972?v=3","gravatar_id":"","url":"https://api.github.com/users/VideoAmp","html_url":"https://github.com/VideoAmp","followers_url":"https://api.github.com/users/VideoAmp/followers","following_url":"https://api.github.com/users/VideoAmp/following{/other_user}","gists_url":"https://api.github.com/users/VideoAmp/gists{/gist_id}","starred_url":"https://api.github.com/users/VideoAmp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VideoAmp/subscriptions","organizations_url":"https://api.github.com/users/VideoAmp/orgs","repos_url":"https://api.github.com/users/VideoAmp/repos","events_url":"https://api.github.com/users/VideoAmp/events{/privacy}","received_events_url":"https://api.github.com/users/VideoAmp/received_events","type":"Organization","site_admin":false},"repo":{"id":49447912,"name":"spark-public","full_name":"VideoAmp/spark-public","owner":{"login":"VideoAmp","id":7621972,"avatar_url":"https://avatars.githubusercontent.com/u/7621972?v=3","gravatar_id":"","url":"https://api.github.com/users/VideoAmp","html_url":"https://github.com/VideoAmp","followers_url":"https://api.github.com/users/VideoAmp/followers","following_url":"https://api.github.com/users/VideoAmp/following{/other_user}","gists_url":"https://api.github.com/users/VideoAmp/gists{/gist_id}","starred_url":"https://api.github.com/users/VideoAmp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VideoAmp/subscriptions","organizations_url":"https://api.github.com/users/VideoAmp/orgs","repos_url":"https://api.github.com/users/VideoAmp/repos","events_url":"https://api.github.com/users/VideoAmp/events{/privacy}","received_events_url":"https://api.github.com/users/VideoAmp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VideoAmp/spark-public","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/VideoAmp/spark-public","forks_url":"https://api.github.com/repos/VideoAmp/spark-public/forks","keys_url":"https://api.github.com/repos/VideoAmp/spark-public/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VideoAmp/spark-public/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VideoAmp/spark-public/teams","hooks_url":"https://api.github.com/repos/VideoAmp/spark-public/hooks","issue_events_url":"https://api.github.com/repos/VideoAmp/spark-public/issues/events{/number}","events_url":"https://api.github.com/repos/VideoAmp/spark-public/events","assignees_url":"https://api.github.com/repos/VideoAmp/spark-public/assignees{/user}","branches_url":"https://api.github.com/repos/VideoAmp/spark-public/branches{/branch}","tags_url":"https://api.github.com/repos/VideoAmp/spark-public/tags","blobs_url":"https://api.github.com/repos/VideoAmp/spark-public/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VideoAmp/spark-public/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VideoAmp/spark-public/git/refs{/sha}","trees_url":"https://api.github.com/repos/VideoAmp/spark-public/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VideoAmp/spark-public/statuses/{sha}","languages_url":"https://api.github.com/repos/VideoAmp/spark-public/languages","stargazers_url":"https://api.github.com/repos/VideoAmp/spark-public/stargazers","contributors_url":"https://api.github.com/repos/VideoAmp/spark-public/contributors","subscribers_url":"https://api.github.com/repos/VideoAmp/spark-public/subscribers","subscription_url":"https://api.github.com/repos/VideoAmp/spark-public/subscription","commits_url":"https://api.github.com/repos/VideoAmp/spark-public/commits{/sha}","git_commits_url":"https://api.github.com/repos/VideoAmp/spark-public/git/commits{/sha}","comments_url":"https://api.github.com/repos/VideoAmp/spark-public/comments{/number}","issue_comment_url":"https://api.github.com/repos/VideoAmp/spark-public/issues/comments{/number}","contents_url":"https://api.github.com/repos/VideoAmp/spark-public/contents/{+path}","compare_url":"https://api.github.com/repos/VideoAmp/spark-public/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VideoAmp/spark-public/merges","archive_url":"https://api.github.com/repos/VideoAmp/spark-public/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VideoAmp/spark-public/downloads","issues_url":"https://api.github.com/repos/VideoAmp/spark-public/issues{/number}","pulls_url":"https://api.github.com/repos/VideoAmp/spark-public/pulls{/number}","milestones_url":"https://api.github.com/repos/VideoAmp/spark-public/milestones{/number}","notifications_url":"https://api.github.com/repos/VideoAmp/spark-public/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VideoAmp/spark-public/labels{/name}","releases_url":"https://api.github.com/repos/VideoAmp/spark-public/releases{/id}","deployments_url":"https://api.github.com/repos/VideoAmp/spark-public/deployments","created_at":"2016-01-11T19:11:30Z","updated_at":"2016-01-11T19:11:55Z","pushed_at":"2016-11-26T22:46:32Z","git_url":"git://github.com/VideoAmp/spark-public.git","ssh_url":"git@github.com:VideoAmp/spark-public.git","clone_url":"https://github.com/VideoAmp/spark-public.git","svn_url":"https://github.com/VideoAmp/spark-public","homepage":null,"size":243313,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"0d1bf2b6c8ac4d4141d7cef0552c22e586843c57","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-11-28T17:12:58Z","pushed_at":"2016-11-28T23:00:55Z","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":615473,"stargazers_count":10882,"watchers_count":10882,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10155,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":456,"forks":10155,"open_issues":456,"watchers":10882,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/15998"},"html":{"href":"https://github.com/apache/spark/pull/15998"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/15998"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/15998/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/15998/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/15998/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/594c6934c4fe4e41a895ea91b3b2cc45f38eaeb6"}}}}
{"actor":{"display_login":"gatorsmile"}}