spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Spark (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-22437) jdbc write fails to set default mode
Date Fri, 03 Nov 2017 15:11:00 GMT

    [ https://issues.apache.org/jira/browse/SPARK-22437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16237716#comment-16237716
] 

Apache Spark commented on SPARK-22437:
--------------------------------------

User 'mgaido91' has created a pull request for this issue:
https://github.com/apache/spark/pull/19654

> jdbc write fails to set default mode
> ------------------------------------
>
>                 Key: SPARK-22437
>                 URL: https://issues.apache.org/jira/browse/SPARK-22437
>             Project: Spark
>          Issue Type: Bug
>          Components: Java API
>    Affects Versions: 2.2.0
>         Environment: python3
>            Reporter: Adrian Bridgett
>
> With this bit of code:
> {code}
>         df.write.jdbc(jdbc_url, table)
> {code}
> We see this error:
> {code}
> 09:54:22 2017-11-03 09:54:19,985 INFO       File "/opt/spark220/python/lib/pyspark.zip/pyspark/sql/readwriter.py",
line 820, in jdbc
> 09:54:22 2017-11-03 09:54:19,985 INFO       File "/opt/spark220/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py",
line 1133, in __call__
> 09:54:22 2017-11-03 09:54:19,986 INFO       File "/opt/spark220/python/lib/pyspark.zip/pyspark/sql/utils.py",
line 63, in deco
> 09:54:22 2017-11-03 09:54:19,986 INFO       File "/opt/spark220/python/lib/py4j-0.10.4-src.zip/py4j/protocol.py",
line 319, in get_return_value
> 09:54:22 2017-11-03 09:54:19,987 INFO     py4j.protocol.Py4JJavaError: An error occurred
while calling o106.jdbc.
> 09:54:22 2017-11-03 09:54:19,987 INFO     : scala.MatchError: null
> 09:54:22 2017-11-03 09:54:19,987 INFO     	at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:62)
> 09:54:22 2017-11-03 09:54:19,987 INFO     	at org.apache.spark.sql.execution.datasources.DataSource.write(DataSource.scala:472)
> 09:54:22 2017-11-03 09:54:19,987 INFO     	at org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:48)
> ...
> {code}
> This seems to be that "mode" isn't correctly picking up the "error" default as listed
in https://spark.apache.org/docs/latest/api/python/pyspark.sql.html#pyspark.sql.DataFrame
> Note that if it was erroring because of existing data it'd say "SaveMode: ErrorIfExists."
as seen in ./sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala).
> Changing our code to this worked:
> {code}
>         df.write.jdbc(jdbc_url, table, mode='append')
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message