waterWang opened a new pull request, #17507: URL: https://github.com/apache/iceberg/pull/17507
## Description For Avro `fixed[N]` fields, the encoder must write fixed-length data without a length prefix. `writeBytes()` writes a length-prefixed bytes value, which corrupts the Avro binary encoding for `fixed[N]` schema. ## Fix Replace `encoder.writeBytes(bytes)` with the correct fixed-length write: ```java byte[] arr = new byte[length]; bytes.duplicate().get(arr); encoder.writeFixed(arr, 0, length); ``` ## Testing - The `Preconditions.checkArgument` validates `bytes.remaining() == length` before the write - `duplicate()` creates a view so the original buffer's position is not modified - All existing tests should pass (the fix only changes the Avro encoding method, not the data) Fixes #17501 -- 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]
