HyukjinKwon commented on a change in pull request #23639: [SPARK-26716][SQL]
FileFormat: the supported types of read/write should be consistent
URL: https://github.com/apache/spark/pull/23639#discussion_r250843298
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala
##########
@@ -178,7 +178,7 @@ private[sql] class JacksonGenerator(
var i = 0
while (i < row.numFields) {
val field = schema(i)
- if (!row.isNullAt(i)) {
+ if (!row.isNullAt(i) || field.dataType == NullType) {
Review comment:
I think this is a bit odd that we write out `null` since `null` has been
ignored in JSON. For instance, when one field is all `null`s, it won't be able
to infer the schema anyway. I think we should match the behaviour.
Maybe we should have an option to write all `null`s out like
`dropFieldIfAllNull` but not sure how useful it would be.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]