thswlsqls opened a new issue, #17053: URL: https://github.com/apache/iceberg/issues/17053
**Apache Iceberg version** main @ 035fc1e40 **Query engine** N/A — engine-agnostic (`iceberg-arrow` vectorized Parquet reader) **Please describe the bug** `VectorizedDictionaryEncodedParquetValuesReader.VarWidthBinaryDictEncodedReader.nextVal()` (arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedDictionaryEncodedParquetValuesReader.java lines 140-152) calls `buffer.array()` and `buffer.arrayOffset()` on the `ByteBuffer` returned by `Dictionary.decodeToBinary(...).toByteBuffer()` without first checking `buffer.hasArray()`. If the dictionary returns a non-array-backed (e.g. direct) `ByteBuffer`, this throws `UnsupportedOperationException`. The three sibling readers in the same module already guard this case with `buffer.hasArray()`: - `VectorizedPlainValuesReader.readBinary()` (line 41-51) - `VectorizedDeltaLengthByteArrayValuesReader.readBinary()` (line 56-72) - `VectorizedDeltaEncodedValuesReader.unpackMiniBlock()` (line 225-240) Parquet's own `Binary$ByteBufferBackedBinary.toStringUsingUTF8()` also checks `hasArray()` before calling `array()`, confirming this `Binary` type does not guarantee an array-backed buffer. **Steps to reproduce** Read a dictionary-encoded VARCHAR/VARBINARY Parquet column where the dictionary page's decompressed `ByteBuffer` is not array-backed (e.g. a direct buffer, depending on the decompression codec path). Expected: values are read normally. Actual: `UnsupportedOperationException` is thrown from `ByteBuffer.array()`. This is reached from `VectorizedParquetDefinitionLevelReader.VarWidthReader.nextDictEncodedVal()`'s `Mode.RLE` branch, which is used whenever a row group has a mix of dictionary-encoded and PLAIN-encoded pages for a VARCHAR/VARBINARY column — a common fallback scenario, not a contrived input. **Additional context** N/A — covered above. -- 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]
