-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I try to write a UUID column.
My first attempt to define the type was
types.add(Types.required(BINARY).as(LogicalTypeAnnotation.uuidType()).named("id"));However, that does not work:
Exception in thread "main" java.lang.IllegalStateException: UUID can only annotate FIXED_LEN_BYTE_ARRAY(16)
at org.apache.parquet.Preconditions.checkState(Preconditions.java:166)
at org.apache.parquet.schema.Types$BasePrimitiveBuilder$1.checkFixedPrimitiveType(Types.java:594)
at org.apache.parquet.schema.Types$BasePrimitiveBuilder$1.visit(Types.java:464)
at org.apache.parquet.schema.LogicalTypeAnnotation$UUIDLogicalTypeAnnotation.accept(LogicalTypeAnnotation.java:1014)
at org.apache.parquet.schema.Types$BasePrimitiveBuilder.build(Types.java:442)
at org.apache.parquet.schema.Types$BasePrimitiveBuilder.build(Types.java:334)
at org.apache.parquet.schema.Types$Builder.named(Types.java:313)
Next I tried to define the type like this:
types.add(Types.required(FIXED_LEN_BYTE_ARRAY).length(16).as(LogicalTypeAnnotation.uuidType()).named("id"));The definition of the schema works. However, when I try to write a value
byte[] uuidBytes = ByteBuffer.allocate(16)
.putLong(uuid.getMostSignificantBits())
.putLong(uuid.getLeastSignificantBits())
.array();
valueWriter.write("id", uuidBytes);it fails because FIXED_LEN_BYTE_ARRAY is not supported:
Exception in thread "main" java.lang.UnsupportedOperationException: We don't support writing FIXED_LEN_BYTE_ARRAY
at blue.strategic.parquet.ParquetWriter$SimpleWriteSupport.writeField(ParquetWriter.java:161)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels