def registerLogicalTypes()

in avro/src/main/scala/magnolify/avro/logical/package.scala [96:165]


    def registerLogicalTypes(): Unit =
      LogicalTypes.register(DateTimeTypeName, DateTimeLogicalTypeFactory)

    // DATETIME
    // YYYY-[M]M-[D]D[ [H]H:[M]M:[S]S[.DDDDDD]]
    private val DatePattern = "yyyy-MM-dd"
    private val TimePattern = "HH:mm:ss"
    private val DecimalPattern = "SSSSSS"
    private val DatetimePattern = s"$DatePattern $TimePattern.$DecimalPattern"
    private val DatetimePrinter = DateTimeFormatter.ofPattern(DatetimePattern)
    private val DatetimeParser = new DateTimeFormatterBuilder()
      .appendPattern(DatePattern)
      .appendOptional(
        new DateTimeFormatterBuilder()
          .appendLiteral(' ')
          .append(new DateTimeFormatterBuilder().appendPattern(TimePattern).toFormatter)
          .appendOptional(
            new DateTimeFormatterBuilder()
              .appendLiteral('.')
              .appendPattern(DecimalPattern)
              .toFormatter
          )
          .toFormatter
      )
      .toFormatter
      .withZone(ZoneOffset.UTC)

    private val JodaDatetimePrinter = new joda.format.DateTimeFormatterBuilder()
      .appendPattern(DatetimePattern)
      .toFormatter

    private val JodaDatetimeParser = new joda.format.DateTimeFormatterBuilder()
      .appendPattern(DatePattern)
      .appendOptional(
        new joda.format.DateTimeFormatterBuilder()
          .appendLiteral(' ')
          .appendPattern(TimePattern)
          .appendOptional(
            new joda.format.DateTimeFormatterBuilder()
              .appendLiteral('.')
              .appendPattern(DecimalPattern)
              .toParser
          )
          .toParser
      )
      .toFormatter
      .withZone(joda.DateTimeZone.UTC)

    // NUMERIC
    // https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#numeric-type
    implicit val afBigQueryNumeric: AvroField[BigDecimal] = AvroField.bigDecimal(38, 9)

    // TIMESTAMP
    implicit val afBigQueryTimestamp: AvroField[Instant] = micros.afTimestampMicros
    implicit val afBigQueryJodaTimestamp: AvroField[joda.DateTime] =
      micros.afJodaTimestampMicros

    // DATE: `AvroField.afDate`

    // TIME
    implicit val afBigQueryTime: AvroField[LocalTime] = micros.afTimeMicros
    implicit val afBigQueryJodaTime: AvroField[joda.LocalTime] = micros.afJodaTimeMicros

    // DATETIME -> sqlType: DATETIME
    implicit val afBigQueryDatetime: AvroField[LocalDateTime] =
      AvroField.logicalType[CharSequence](new org.apache.avro.LogicalType(DateTimeTypeName)) { cs =>
        LocalDateTime.parse(cs.toString, DatetimeParser)
      } { datetime =>
        DatetimePrinter.format(datetime)
      }