Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/18875#discussion_r137975134
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala
---
@@ -193,14 +228,32 @@ private[sql] class JacksonGenerator(
*
* @param row The row to convert
*/
- def write(row: InternalRow): Unit = writeObject(writeFields(row, schema,
rootFieldWriters))
+ def write(row: InternalRow): Unit = dataType match {
+ case st: StructType =>
+ writeObject(writeFields(row, st, rootFieldWriters))
+ case _ => throw new UnsupportedOperationException(
--- End diff --
Rethinking about this, I think we can avoid matching the data type and
simply do `writeObject(writeFields(row, schema, rootFieldWriters))` like
before. When accessing `rootFieldWriters`, there is an exception thrown then.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]