diff options
author | Dongjoon Hyun <dongjoon@apache.org> | 2016-12-30 10:27:14 -0800 |
---|---|---|
committer | gatorsmile <gatorsmile@gmail.com> | 2016-12-30 10:27:14 -0800 |
commit | b85e29437d570118f5980a1d6ba56c1f06a3dfd1 (patch) | |
tree | c0e0b305a8fe60c4a535517fbdd489e735ae7777 /docs/sql-programming-guide.md | |
parent | 852782b83c89c358cf429e3913b71a1a6c44f27a (diff) | |
download | spark-b85e29437d570118f5980a1d6ba56c1f06a3dfd1.tar.gz spark-b85e29437d570118f5980a1d6ba56c1f06a3dfd1.tar.bz2 spark-b85e29437d570118f5980a1d6ba56c1f06a3dfd1.zip |
[SPARK-18123][SQL] Use db column names instead of RDD column ones during JDBC Writing
## What changes were proposed in this pull request?
Apache Spark supports the following cases **by quoting RDD column names** while saving through JDBC.
- Allow reserved keyword as a column name, e.g., 'order'.
- Allow mixed-case colume names like the following, e.g., `[a: int, A: int]`.
``` scala
scala> val df = sql("select 1 a, 1 A")
df: org.apache.spark.sql.DataFrame = [a: int, A: int]
...
scala> df.write.mode("overwrite").format("jdbc").options(option).save()
scala> df.write.mode("append").format("jdbc").options(option).save()
```
This PR aims to use **database column names** instead of RDD column ones in order to support the following additionally.
Note that this case succeeds with `MySQL`, but fails on `Postgres`/`Oracle` before.
``` scala
val df1 = sql("select 1 a")
val df2 = sql("select 1 A")
...
df1.write.mode("overwrite").format("jdbc").options(option).save()
df2.write.mode("append").format("jdbc").options(option).save()
```
## How was this patch tested?
Pass the Jenkins test with a new testcase.
Author: Dongjoon Hyun <dongjoon@apache.org>
Author: gatorsmile <gatorsmile@gmail.com>
Closes #15664 from dongjoon-hyun/SPARK-18123.
Diffstat (limited to 'docs/sql-programming-guide.md')
0 files changed, 0 insertions, 0 deletions