homar opened a new issue #3704:
URL: https://github.com/apache/iceberg/issues/3704
Simplest way to reproduce:
```BaseTable table = ;//...
table.updateSchema().addColumn("_fixed",
Types.FixedType.ofLength(6)).commit();
TableMetadata currentMetadata = table.operations().current();
PartitionSpec partitionSpec =
PartitionSpec.builderFor(table.schema()).identity("_fixed").build();
TableMetadata newMetadata =
table.operations().current().updatePartitionSpec(partitionSpec);
table.operations().commit(currentMetadata, newMetadata);
DataFile data = DataFiles.builder(table.spec())
.withPath("ignoredWithoutReading")
.withFileSizeInBytes(410)
.withFormat("ORC")
.withMetrics(new Metrics(0L, null, ImmutableMap.of(),
ImmutableMap.of()))
.withPartition(PartitionData.fromJson("{\"partitionValues\":[\"/wD/7v/u\"]}",
new Type[]{Types.FixedType.ofLength(6)}))
.build();
table.newAppend().appendFile(data).commit()
// Caused by: java.lang.ClassCastException: class java.nio.HeapByteBuffer
cannot be cast to class org.apache.avro.generic.GenericData$Fixed
(java.nio.HeapByteBuffer is in module java.base of loader 'bootstrap';
org.apache.avro.generic.GenericData$Fixed is in unnamed module of loader 'app')
`
The problem is that value of Fixed column is first wrapped in ByteBuffer and
then ValueWriters try to cast it to GenericData.Fixed .
Wrapping is done based on the javaClass that comes from PartitionSpec and in
my case PartitionSpec is generated by the BaseTable . Basically it comes from
https://github.com/apache/iceberg/blob/202628df7f914bd184ba49226256cc1edea0e18e/api/src/main/java/org/apache/iceberg/types/Type.java#L40
It works fine with `binary` column.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]