waterWang opened a new pull request, #17505: URL: https://github.com/apache/iceberg/pull/17505
## Bug fix: `FixedByteBufferWriter` uses `writeBytes` instead of `writeFixed` for Avro `fixed[N]` fields Fixes #17501 ### Problem `ValueWriters.FixedByteBufferWriter.write(ByteBuffer, Encoder)` calls `encoder.writeBytes(bytes)` instead of `encoder.writeFixed(bytes)`. For Avro `fixed[N]` fields this is wrong: `writeBytes` prepends a zigzag-encoded length prefix before the data, but the Avro reader consumes exactly N bytes for a `fixed` field and has no length prefix to skip. The stray prefix byte spills into the next field in the record. ### Fix Convert the `ByteBuffer` to a `byte[]` and call `encoder.writeFixed(arr)` instead. ### Testing Existing tests for `fixed[N]` fields with `ByteBuffer` values should now pass without corruption. The sibling class `FixedWriter` (which handles `byte[]`) already uses `writeFixed` correctly. -- 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]
