in scio-google-cloud-platform/src/main/scala/com/spotify/scio/bigquery/types/SchemaUtil.scala [30:58]
def toPrettyString(schema: TableSchema, name: String, indent: Int): String =
"@BigQueryType.toTable\n" +
getCaseClass(schema.getFields, name, indent)
private def getRawType(tfs: TableFieldSchema, indent: Int): (String, Seq[String]) = {
val name = tfs.getType match {
case "BOOLEAN" => "Boolean"
case "INTEGER" | "INT64" => "Long"
case "FLOAT" | "FLOAT64" => "Double"
case "STRING" => "String"
case "NUMERIC" => "BigDecimal"
case "BYTES" => "ByteString"
case "TIMESTAMP" => "Instant"
case "DATE" => "LocalDate"
case "TIME" => "LocalTime"
case "DATETIME" => "LocalDateTime"
case "GEOGRAPHY" => "Geography"
case "JSON" => "Json"
case "BIGNUMERIC" => "BigNumeric"
case "RECORD" | "STRUCT" => NameProvider.getUniqueName(tfs.getName)
case t => throw new IllegalArgumentException(s"Type: $t not supported")
}
if (tfs.getType == "RECORD") {
val nested = getCaseClass(tfs.getFields, name, indent)
(name, Seq(nested))
} else {
(name, Seq.empty)
}
}