in scio-extra/src/main/scala/com/spotify/scio/extra/bigquery/ToTableRow.scala [67:91]
private[bigquery] def toTableRowField(fieldValue: Any, field: Schema.Field): Any =
fieldValue match {
case x: CharSequence => x.toString
case x: EnumSymbol => x.toString
case x: Enum[_] => x.name()
case x: JBigDecimal => x.toString
case x: Number => x
case x: Boolean => x
case x: GenericFixed => encodeByteArray(x.bytes(), field.schema())
case x: ByteBuffer => encodeByteArray(toByteArray(x), field.schema())
case x: util.Map[_, _] => toTableRowFromMap(x.asScala, field)
case x: java.lang.Iterable[_] => toTableRowFromIterable(x.asScala, field)
case x: IndexedRecord => AvroConverters.toTableRow(x)
case x: LocalDate => LocalDateFormatter.format(x)
case x: LocalTime => LocalTimeFormatter.format(x)
case x: Instant => TimestampFormatter.format(x)
case x: org.joda.time.LocalDate => JodaLocalDateFormatter.print(x)
case x: org.joda.time.LocalTime => JodaLocalTimeFormatter.print(x)
case x: org.joda.time.DateTime => JodaTimestampFormatter.print(x)
case _ =>
throw AvroConversionException(
s"ToTableRow conversion failed:" +
s"could not match ${fieldValue.getClass}"
)
}