GitHub user CK50 opened a pull request:
https://github.com/apache/spark/pull/10312
[SPARK-12010][SQL] Add columnMapping support
In the past Spark JDBC write only worked with technologies which support
the following INSERT statement syntax (JdbcUtils.scala: insertStatement()):
INSERT INTO $table VALUES ( ?, ?, ..., ? )
But some technologies require a list of column names:
INSERT INTO $table ( $colNameList ) VALUES ( ?, ?, ..., ? )
This was blocking the use of e.g. the Progress JDBC Driver for Cassandra.
Another limitation is that syntax 1 relies no the dataframe field ordering
match that of the target table. This works fine, as long as the target table
has been created by writer.jdbc().
If the target table contains more columns (not created by writer.jdbc()),
then the insert fails due mismatch of number of columns or their data types.
This PR adds an extra columnMapping parameter to write.jdbc(). This
optional parameter allows the user to specify how dataframe field names are
mapping to target table column names.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/CK50/spark master-SPARK-12010
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/10312.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #10312
----
commit 165b198709e7ef4436e665517fa505b09ba93aab
Author: CK50 <[email protected]>
Date: 2015-12-15T16:59:06Z
[SPARK-12010][SQL] Add columnMapping support
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]