danielcweeks commented on code in PR #13997:
URL: https://github.com/apache/iceberg/pull/13997#discussion_r2342331430
##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetIO.java:
##########
@@ -123,6 +135,64 @@ public void seek(long newPos) throws IOException {
}
}
+ private static class ParquetRangeReadableInputStreamAdapter<
+ T extends org.apache.iceberg.io.SeekableInputStream & RangeReadable>
+ extends DelegatingSeekableInputStream implements RangeReadable {
+ private final T delegate;
+
+ private ParquetRangeReadableInputStreamAdapter(T delegate) {
+ super(delegate);
+ this.delegate = delegate;
+ }
+
+ @Override
+ public long getPos() throws IOException {
+ return delegate.getPos();
+ }
+
+ @Override
+ public void seek(long newPos) throws IOException {
+ delegate.seek(newPos);
+ }
+
+ @Override
+ public void readFully(long position, byte[] buffer, int offset, int
length) throws IOException {
+ delegate.readFully(position, buffer, offset, length);
+ }
+
+ @Override
+ public int readTail(byte[] buffer, int offset, int length) throws
IOException {
+ return delegate.readTail(buffer, offset, length);
+ }
+
+ @Override
+ public boolean readVectoredAvailable(ByteBufferAllocator allocate) {
+ return true;
+ }
+
+ @Override
+ public void readVectored(List<ParquetFileRange> ranges,
ByteBufferAllocator allocate)
+ throws IOException {
+ IntFunction<ByteBuffer> delegateAllocate = (allocate::allocate);
+ List<FileRange> delegateRange = convertRanges(ranges);
Review Comment:
I'm not convinced this works correctly. We're converting the ranges first,
but we actually need the allocated bytebuffer futures to be set before we
return. I believe this will convert the ranges, then drop the allocated
buffers since they were allocated after conversion.
--
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]