implicit def pfEnum[T]()

in parquet/src/main/scala/magnolify/parquet/ParquetField.scala [580:611]


  implicit def pfEnum[T](implicit et: EnumType[T]): Primitive[T] =
    logicalType[String](LogicalTypeAnnotation.enumType())(et.from)(et.to)

  implicit val ptUuid: Primitive[UUID] = new Primitive[UUID] {
    override def buildSchema(cm: CaseMapper, properties: MagnolifyParquetProperties): Type =
      Schema.primitive(PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY, length = 16)

    override def write(
      c: RecordConsumer,
      v: UUID
    )(cm: CaseMapper, properties: MagnolifyParquetProperties): Unit =
      c.addBinary(
        Binary.fromConstantByteArray(
          ByteBuffer
            .allocate(16)
            .order(ByteOrder.BIG_ENDIAN)
            .putLong(v.getMostSignificantBits)
            .putLong(v.getLeastSignificantBits)
            .array()
        )
      )

    override def newConverter(writerSchema: Type): TypeConverter[UUID] =
      TypeConverter.newByteArray.map { ba =>
        val bb = ByteBuffer.wrap(ba)
        val h = bb.getLong
        val l = bb.getLong
        new UUID(h, l)
      }

    override type ParquetT = Binary
  }