GitHub user CK50 opened a pull request:
https://github.com/apache/spark/pull/10380
[SPARK-12010][SQL] Spark JDBC requires support for column-name-free INSERT
syntax
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 switches to the recommended second INSERT syntax. Column names are
taken from datafram field names.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/CK50/spark master-SPARK-12010-2
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/10380.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 #10380
----
commit 3211963805edff521a08f69193aaf2b8a09b85f8
Author: CK50 <[email protected]>
Date: 2015-12-18T14:14:28Z
Initial version of suggested simple approach
commit 0772db3ff7a4591380436c078cb5a0959550eab1
Author: CK50 <[email protected]>
Date: 2015-12-18T14:18:23Z
comment removed
----
---
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]