Github user goldmedal commented on a diff in the pull request: https://github.com/apache/spark/pull/18875#discussion_r137976953 --- 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 -- @viirya I found if we don't check it in here, it will throw `ClassCastExceptoin` from `writeObject()` firstly. So, maybe we don't need to check type in `rootFieldWriters` ?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org