You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2016/10/03 07:58:20 UTC

[jira] [Commented] (SPARK-17763) JacksonParser silently parses null as 0 when the field is not nullable

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

Apache Spark commented on SPARK-17763:
--------------------------------------

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

> JacksonParser silently parses null as 0 when the field is not nullable
> ----------------------------------------------------------------------
>
>                 Key: SPARK-17763
>                 URL: https://issues.apache.org/jira/browse/SPARK-17763
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Hyukjin Kwon
>
> It seems {{JacksonParser}} parses the json when the field is not nullable, it parses some data as 0 silently. For example,
> {code}
> val testJson = """{"nullInt":null}""" :: Nil
> val testSchema = StructType(StructField("nullInt", IntegerType, false) :: Nil)
> val data = spark.sparkContext.parallelize(testJson)
> spark.read.schema(testSchema).json(data).show()
> {code}
> shows
> {code}
> +-------+
> |nullInt|
> +-------+
> |      0|
> +-------+
> {code}
> This will also affect {{from_json}} function.



--
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