rayokota opened a new issue, #3471:
URL: https://github.com/apache/parquet-java/issues/3471

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Description:
     
   - `getMetadataMap` incorrect position
   
     In `VariantUtil.getMetadataMap`, the else-branch (read-only or 
non-array-backed
     `ByteBuffer`) computes the slice position incorrectly:
   
     ```
     slice(metadata, stringStart + offset)
     ```
   
     `stringStart` is relative to `pos` (`metadata.position()`), but the 
array-backed
     branch correctly adds `pos`:
   
     ```
     metadata.arrayOffset() + pos + stringStart + offset
     ```
   
     This causes incorrect dictionary parsing or exceptions when the metadata
     `ByteBuffer` has a non-zero position (e.g., when it is a slice of a larger 
buffer).
   
     The sibling method `getMetadataKey` does not have this bug because 
`dataPos` is
     computed as an absolute position.
   
   - `appendBinary` mutates caller's `ByteBuffer`
   
     `VariantBuilder.appendBinary(ByteBuffer)` calls `.put(binary)` which 
advances the
     caller's `ByteBuffer` position. The analogous method `appendEncodedValue` 
uses
     `value.duplicate().get(...)` to avoid this side effect.
   
   
   ### Component(s)
   
   Core


-- 
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]

Reply via email to