Skip to content

Commit

Permalink
Code simplification for maps and structs as elements of arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGekk committed Sep 3, 2018
1 parent 7d1cde4 commit 72d2628
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,7 @@ private[sql] class JacksonGenerator(
// `ValueWriter` for array data storing rows of the schema.
private lazy val arrElementWriter: ValueWriter = dataType match {
case at: ArrayType => makeWriter(at.elementType)
case st: StructType =>
(arr: SpecializedGetters, i: Int) => {
writeObject(writeFields(arr.getStruct(i, st.length), st, rootFieldWriters))
}
case mt: MapType =>
(arr: SpecializedGetters, i: Int) => {
writeObject(writeMapData(arr.getMap(i), mt, mapElementWriter))
}
case _: StructType | _: MapType => makeWriter(dataType)
case _ => throw new UnsupportedOperationException(
s"Initial type ${dataType.catalogString} must be " +
s"an ${ArrayType.simpleString}, a ${StructType.simpleString} or a ${MapType.simpleString}")
Expand Down

0 comments on commit 72d2628

Please sign in to comment.