{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/67578077","id":67578077,"diff_hunk":"@@ -572,4 +572,16 @@ class DataFrameReaderWriterSuite extends StreamTest with BeforeAndAfter {\n \n     cq.awaitTermination(2000L)\n   }\n+\n+  test(\"prevent all column partitioning\") {\n+    withTempDir { dir =>\n+      val path = dir.getCanonicalPath\n+      intercept[AnalysisException] {\n+        spark.range(10).write.format(\"parquet\").mode(\"overwrite\").partitionBy(\"id\").save(path)\n+      }\n+      intercept[AnalysisException] {\n+        spark.range(10).write.format(\"orc\").mode(\"overwrite\").partitionBy(\"id\").save(path)","path":"sql/core/src/test/scala/org/apache/spark/sql/streaming/test/DataFrameReaderWriterSuite.scala","position":12,"original_position":12,"commit_id":"46d420849cab97581c9833c8601ee10e037dc45e","original_commit_id":"46d420849cab97581c9833c8601ee10e037dc45e","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":"This test case is wrong, right? This exception message will be like `The ORC data source must be used with Hive support enabled`. To test this, we need to move this to another suite. \r\n\r\nWill fix it in my ongoing PR. My suggestion is to always verify the error message, if possible.","created_at":"2016-06-17T21:27:50Z","updated_at":"2016-06-17T21:27:50Z","html_url":"https://github.com/apache/spark/pull/13486#discussion_r67578077","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/13486","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/67578077"},"html":{"href":"https://github.com/apache/spark/pull/13486#discussion_r67578077"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/13486"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/13486","id":72437770,"html_url":"https://github.com/apache/spark/pull/13486","diff_url":"https://github.com/apache/spark/pull/13486.diff","patch_url":"https://github.com/apache/spark/pull/13486.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/13486","number":13486,"state":"closed","locked":false,"title":"[SPARK-15743][SQL] Prevent saving with all-column partitioning","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\nWhen saving datasets on storage, `partitionBy` provides an easy way to construct the directory structure. However, if a user choose all columns as partition columns, some exceptions occurs.\r\n\r\n- **ORC with all column partitioning**: `AnalysisException` on **future read** due to schema inference failure.\r\n ```scala\r\nscala> spark.range(10).write.format(\"orc\").mode(\"overwrite\").partitionBy(\"id\").save(\"/tmp/data\")\r\n                                                                                \r\nscala> spark.read.format(\"orc\").load(\"/tmp/data\").collect()\r\norg.apache.spark.sql.AnalysisException: Unable to infer schema for ORC at /tmp/data. It must be specified manually;\r\n```\r\n\r\n- **Parquet with all-column partitioning**: `InvalidSchemaException` on **write execution** due to Parquet limitation.\r\n ```scala\r\nscala> spark.range(100).write.format(\"parquet\").mode(\"overwrite\").partitionBy(\"id\").save(\"/tmp/data\")\r\n[Stage 0:>                                                          (0 + 8) / 8]16/06/02 16:51:17\r\nERROR Utils: Aborting task\r\norg.apache.parquet.schema.InvalidSchemaException: A group type can not be empty. Parquet does not support empty group without leaves. Empty group: spark_schema\r\n... (lots of error messages)\r\n```\r\n\r\nAlthough some formats like JSON support all-column partitioning without any problem, it seems not a good idea to make lots of empty directories. \r\n\r\nThis PR prevents saving with all-column partitioning by consistently raising `AnalysisException` before executing save operation. \r\n\r\n## How was this patch tested?\r\n\r\nNewly added `PartitioningUtilsSuite`.","created_at":"2016-06-03T00:18:33Z","updated_at":"2016-06-17T21:27:50Z","closed_at":"2016-06-10T19:45:23Z","merged_at":null,"merge_commit_sha":"94683e9ada5f9b524995a97bb51b160e17f8c96a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/13486/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/13486/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/13486/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/46d420849cab97581c9833c8601ee10e037dc45e","head":{"label":"dongjoon-hyun:SPARK-15743","ref":"SPARK-15743","sha":"46d420849cab97581c9833c8601ee10e037dc45e","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-02-21T23:51:21Z","pushed_at":"2016-06-17T21:00:16Z","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":169336,"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":"ca70ab27cc73f6ea7fce5d179ca8f13459c8ba95","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-06-17T17:56:02Z","pushed_at":"2016-06-17T20:47:01Z","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":497715,"stargazers_count":8960,"watchers_count":8960,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8322,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":380,"forks":8322,"open_issues":380,"watchers":8960,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/13486"},"html":{"href":"https://github.com/apache/spark/pull/13486"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/13486"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/13486/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/13486/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/13486/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/46d420849cab97581c9833c8601ee10e037dc45e"}}}}
{"actor":{"display_login":"gatorsmile"}}