{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/94094799","pull_request_review_id":14625338,"id":94094799,"diff_hunk":"@@ -568,10 +617,9 @@ object JdbcUtils extends Logging {\n         conn.setAutoCommit(false) // Everything in the same db transaction.\n         conn.setTransactionIsolation(finalIsolationLevel)\n       }\n-      val stmt = insertStatement(conn, table, rddSchema, dialect)\n-      val setters: Array[JDBCValueSetter] = rddSchema.fields.map(_.dataType)\n-        .map(makeSetter(conn, dialect, _)).toArray\n-      val numFields = rddSchema.fields.length\n+      val stmt = insertStatement(conn, table, schema, dialect)","path":"sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala","position":96,"original_position":96,"commit_id":"86ab6df26c052ef979e42006ae9d4159a01e83b6","original_commit_id":"86ab6df26c052ef979e42006ae9d4159a01e83b6","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":"See the comment in https://github.com/apache/spark/pull/15664#discussion_r94094625","created_at":"2016-12-29T01:49:26Z","updated_at":"2016-12-29T01:49:26Z","html_url":"https://github.com/apache/spark/pull/15664#discussion_r94094799","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/15664","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/94094799"},"html":{"href":"https://github.com/apache/spark/pull/15664#discussion_r94094799"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/15664"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/15664","id":91291349,"html_url":"https://github.com/apache/spark/pull/15664","diff_url":"https://github.com/apache/spark/pull/15664.diff","patch_url":"https://github.com/apache/spark/pull/15664.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/15664","number":15664,"state":"open","locked":false,"title":"[SPARK-18123][SQL] Use db column names instead of RDD column ones during JDBC Writing","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?\n\nApache Spark supports the following cases **by quoting RDD column names** while saving through JDBC.\n- Allow reserved keyword as a column name, e.g., 'order'.\n- Allow mixed-case colume names like the following, e.g., `[a: int, A: int]`.\n  \n  ``` scala\n  scala> val df = sql(\"select 1 a, 1 A\")\n  df: org.apache.spark.sql.DataFrame = [a: int, A: int]\n  ...\n  scala> df.write.mode(\"overwrite\").format(\"jdbc\").options(option).save()\n  scala> df.write.mode(\"append\").format(\"jdbc\").options(option).save()\n  ```\n\nThis PR aims to use **database column names** instead of RDD column ones in order to support the following additionally.\nNote that this case succeeds with `MySQL`, but fails on `Postgres`/`Oracle` before.\n\n``` scala\nval df1 = sql(\"select 1 a\")\nval df2 = sql(\"select 1 A\")\n...\ndf1.write.mode(\"overwrite\").format(\"jdbc\").options(option).save()\ndf2.write.mode(\"append\").format(\"jdbc\").options(option).save()\n```\n## How was this patch tested?\n\nPass the Jenkins test with a new testcase.\n","created_at":"2016-10-27T22:20:19Z","updated_at":"2016-12-29T01:49:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b078def9349dacf5c1ab3013064f6d6c9c6a92b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/15664/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/15664/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/15664/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/86ab6df26c052ef979e42006ae9d4159a01e83b6","head":{"label":"dongjoon-hyun:SPARK-18123","ref":"SPARK-18123","sha":"86ab6df26c052ef979e42006ae9d4159a01e83b6","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-12-29T01:46:34Z","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":248458,"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":"092c6725bf039bf33299b53791e1958c4ea3f6aa","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-12-28T16:57:57Z","pushed_at":"2016-12-29T01:46:36Z","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":259283,"stargazers_count":11230,"watchers_count":11230,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10529,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":449,"forks":10529,"open_issues":449,"watchers":11230,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/15664"},"html":{"href":"https://github.com/apache/spark/pull/15664"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/15664"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/15664/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/15664/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/15664/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/86ab6df26c052ef979e42006ae9d4159a01e83b6"}}}}
{"actor":{"display_login":"gatorsmile"}}