You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xiao Li (JIRA)" <ji...@apache.org> on 2016/08/18 23:54:20 UTC

[jira] [Commented] (SPARK-17081) Empty strings not preserved which causes SQLException: mismatching column value count

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

Xiao Li commented on SPARK-17081:
---------------------------------

Can you try to reproduce it in Spark 2.0? Thanks!

> Empty strings not preserved which causes SQLException: mismatching column value count
> -------------------------------------------------------------------------------------
>
>                 Key: SPARK-17081
>                 URL: https://issues.apache.org/jira/browse/SPARK-17081
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.4.1
>            Reporter: Ian Hellstrom
>              Labels: dataframe, empty, jdbc, null, sql
>
> When writing a DataFrame that contains empty strings as values to an RDBMS, the query that is generated does not have the correct column count:
> {code}
> CREATE TABLE demo(foo INTEGER, bar VARCHAR(10));
> -----
> case class Record(foo: Int, bar: String)
> val data = sc.parallelize(List(Record(1, ""))).toDF
> data.write.mode("append").jdbc(...)
> {code}
> This causes:
> {code}
> java.sql.SQLException: Column count doesn't match value count at row 1
> {code}
> Proposal: leave empty strings as they are or convert these to NULL (although that may not be what's intended by the user, so make this configurable). 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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