{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/74027475","id":74027475,"diff_hunk":"@@ -447,7 +447,16 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) {\n       // Create the table if the table didn't exist.\n       if (!tableExists) {\n         val schema = JdbcUtils.schemaString(df, url)\n-        val sql = s\"CREATE TABLE $table ($schema)\"\n+        // To allow certain options to append when create a new table, which can be\n+        // table_options or partition_options.\n+        // E.g., \"CREATE TABLE t (name string) ENGINE=InnoDB DEFAULT CHARSET=utf8\"\n+        val createtblOptions = {\n+          extraOptions.get(\"jdbc.create.table.options\") match {","path":"sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala","position":9,"original_position":9,"commit_id":"b302b1c7ec75ae1e78d132f7ecdb9bb7f33816d4","original_commit_id":"b302b1c7ec75ae1e78d132f7ecdb9bb7f33816d4","user":{"login":"GraceH","id":1960093,"avatar_url":"https://avatars.githubusercontent.com/u/1960093?v=3","gravatar_id":"","url":"https://api.github.com/users/GraceH","html_url":"https://github.com/GraceH","followers_url":"https://api.github.com/users/GraceH/followers","following_url":"https://api.github.com/users/GraceH/following{/other_user}","gists_url":"https://api.github.com/users/GraceH/gists{/gist_id}","starred_url":"https://api.github.com/users/GraceH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GraceH/subscriptions","organizations_url":"https://api.github.com/users/GraceH/orgs","repos_url":"https://api.github.com/users/GraceH/repos","events_url":"https://api.github.com/users/GraceH/events{/privacy}","received_events_url":"https://api.github.com/users/GraceH/received_events","type":"User","site_admin":false},"body":"Thanks Sean. Actually, here I have a little bit hesitation. For example, \"mergeSchema\" which may not be so that similar to the other option name (prefixed with \"spark\"). \r\n```\r\nval mergedDF = spark.read.option(\"mergeSchema\", \"true\").parquet(\"data/test_table\")\r\n```\r\n\r\nHow about to use some short name as \"createTableOptions\"?","created_at":"2016-08-09T09:38:12Z","updated_at":"2016-08-09T09:38:12Z","html_url":"https://github.com/apache/spark/pull/14559#discussion_r74027475","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/14559","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/74027475"},"html":{"href":"https://github.com/apache/spark/pull/14559#discussion_r74027475"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/14559"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/14559","id":80576402,"html_url":"https://github.com/apache/spark/pull/14559","diff_url":"https://github.com/apache/spark/pull/14559.diff","patch_url":"https://github.com/apache/spark/pull/14559.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/14559","number":14559,"state":"open","locked":false,"title":"[SPARK-16968]Add additional options in jdbc when creating a new table","user":{"login":"GraceH","id":1960093,"avatar_url":"https://avatars.githubusercontent.com/u/1960093?v=3","gravatar_id":"","url":"https://api.github.com/users/GraceH","html_url":"https://github.com/GraceH","followers_url":"https://api.github.com/users/GraceH/followers","following_url":"https://api.github.com/users/GraceH/following{/other_user}","gists_url":"https://api.github.com/users/GraceH/gists{/gist_id}","starred_url":"https://api.github.com/users/GraceH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GraceH/subscriptions","organizations_url":"https://api.github.com/users/GraceH/orgs","repos_url":"https://api.github.com/users/GraceH/repos","events_url":"https://api.github.com/users/GraceH/events{/privacy}","received_events_url":"https://api.github.com/users/GraceH/received_events","type":"User","site_admin":false},"body":"## What changes were proposed in this pull request?\r\n\r\nIn the PR, we just allow the user to add additional options when create a new table in JDBC writer. \r\nThe options can be table_options or partition_options.\r\nE.g., \"CREATE TABLE t (name string) ENGINE=InnoDB DEFAULT CHARSET=utf8\"\r\n\r\nHere is the usage example:\r\n```\r\ndf.write.option(\"jdbc.create.table.options\", \"ENGINE=InnoDB DEFAULT CHARSET=utf8\").jdbc(...)\r\n```\r\n## How was this patch tested?\r\n\r\n(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)\r\nwill apply test result soon.\r\n\r\n","created_at":"2016-08-09T07:57:22Z","updated_at":"2016-08-09T09:38:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0454a45b6ff8e42d4b967b713c79de7d11d1cb34","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/14559/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/14559/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/14559/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/b302b1c7ec75ae1e78d132f7ecdb9bb7f33816d4","head":{"label":"GraceH:jdbc_options","ref":"jdbc_options","sha":"b302b1c7ec75ae1e78d132f7ecdb9bb7f33816d4","user":{"login":"GraceH","id":1960093,"avatar_url":"https://avatars.githubusercontent.com/u/1960093?v=3","gravatar_id":"","url":"https://api.github.com/users/GraceH","html_url":"https://github.com/GraceH","followers_url":"https://api.github.com/users/GraceH/followers","following_url":"https://api.github.com/users/GraceH/following{/other_user}","gists_url":"https://api.github.com/users/GraceH/gists{/gist_id}","starred_url":"https://api.github.com/users/GraceH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GraceH/subscriptions","organizations_url":"https://api.github.com/users/GraceH/orgs","repos_url":"https://api.github.com/users/GraceH/repos","events_url":"https://api.github.com/users/GraceH/events{/privacy}","received_events_url":"https://api.github.com/users/GraceH/received_events","type":"User","site_admin":false},"repo":{"id":25564729,"name":"spark","full_name":"GraceH/spark","owner":{"login":"GraceH","id":1960093,"avatar_url":"https://avatars.githubusercontent.com/u/1960093?v=3","gravatar_id":"","url":"https://api.github.com/users/GraceH","html_url":"https://github.com/GraceH","followers_url":"https://api.github.com/users/GraceH/followers","following_url":"https://api.github.com/users/GraceH/following{/other_user}","gists_url":"https://api.github.com/users/GraceH/gists{/gist_id}","starred_url":"https://api.github.com/users/GraceH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GraceH/subscriptions","organizations_url":"https://api.github.com/users/GraceH/orgs","repos_url":"https://api.github.com/users/GraceH/repos","events_url":"https://api.github.com/users/GraceH/events{/privacy}","received_events_url":"https://api.github.com/users/GraceH/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GraceH/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/GraceH/spark","forks_url":"https://api.github.com/repos/GraceH/spark/forks","keys_url":"https://api.github.com/repos/GraceH/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GraceH/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GraceH/spark/teams","hooks_url":"https://api.github.com/repos/GraceH/spark/hooks","issue_events_url":"https://api.github.com/repos/GraceH/spark/issues/events{/number}","events_url":"https://api.github.com/repos/GraceH/spark/events","assignees_url":"https://api.github.com/repos/GraceH/spark/assignees{/user}","branches_url":"https://api.github.com/repos/GraceH/spark/branches{/branch}","tags_url":"https://api.github.com/repos/GraceH/spark/tags","blobs_url":"https://api.github.com/repos/GraceH/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GraceH/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GraceH/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/GraceH/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GraceH/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/GraceH/spark/languages","stargazers_url":"https://api.github.com/repos/GraceH/spark/stargazers","contributors_url":"https://api.github.com/repos/GraceH/spark/contributors","subscribers_url":"https://api.github.com/repos/GraceH/spark/subscribers","subscription_url":"https://api.github.com/repos/GraceH/spark/subscription","commits_url":"https://api.github.com/repos/GraceH/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/GraceH/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/GraceH/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/GraceH/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/GraceH/spark/contents/{+path}","compare_url":"https://api.github.com/repos/GraceH/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GraceH/spark/merges","archive_url":"https://api.github.com/repos/GraceH/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GraceH/spark/downloads","issues_url":"https://api.github.com/repos/GraceH/spark/issues{/number}","pulls_url":"https://api.github.com/repos/GraceH/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/GraceH/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/GraceH/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GraceH/spark/labels{/name}","releases_url":"https://api.github.com/repos/GraceH/spark/releases{/id}","deployments_url":"https://api.github.com/repos/GraceH/spark/deployments","created_at":"2014-10-22T06:06:27Z","updated_at":"2014-10-22T03:01:45Z","pushed_at":"2016-08-09T06:49:42Z","git_url":"git://github.com/GraceH/spark.git","ssh_url":"git@github.com:GraceH/spark.git","clone_url":"https://github.com/GraceH/spark.git","svn_url":"https://github.com/GraceH/spark","homepage":null,"size":164892,"stargazers_count":0,"watchers_count":0,"language":null,"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":"bb2b9d0a428b86bf366ee9916e26402f8c00912f","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-08-09T09:30:52Z","pushed_at":"2016-08-09T09:31:51Z","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":508748,"stargazers_count":9595,"watchers_count":9595,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8916,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":456,"forks":8916,"open_issues":456,"watchers":9595,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/14559"},"html":{"href":"https://github.com/apache/spark/pull/14559"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/14559"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/14559/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/14559/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/14559/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/b302b1c7ec75ae1e78d132f7ecdb9bb7f33816d4"}}}}
{"actor":{"display_login":"GraceH"}}