Github user patrickmcgloin commented on a diff in the pull request: https://github.com/apache/spark/pull/21671#discussion_r199319246 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala --- @@ -163,6 +175,22 @@ private[sql] class JacksonGenerator( s"with the type of $dataType to JSON.") } + private def makeReader(dataType: DataType): ValueReader = dataType match { + + case TimestampType => + (row: SpecializedGetters, ordinal: Int) => + options.timestampFormat.format(DateTimeUtils.toJavaTimestamp(row.getLong(ordinal))) + + case DateType => + (row: SpecializedGetters, ordinal: Int) => + options.dateFormat.format(DateTimeUtils.toJavaDate(row.getInt(ordinal))) + + case _ => + (row: SpecializedGetters, ordinal: Int) => + row.get(ordinal, dataType).toString --- End diff -- I considered this the default case and thought it would be covered by existing Unit Tests. Which types should I add tests for? Int, String, Long, etc. All of the children of AtomicType? Nested types is interesting. I will add some tests for keys with a Seq[Int], Map[String, Int] to see that they work. If there was something else you were thinking of please let me know.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org