stubz151 commented on code in PR #13997:
URL: https://github.com/apache/iceberg/pull/13997#discussion_r2325184237
##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetIO.java:
##########
@@ -123,6 +135,62 @@ 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 delegate.readVectoredAvailable(allocate::allocate);
+ }
+
+ @Override
+ public void readVectored(List<ParquetFileRange> ranges,
ByteBufferAllocator allocate)
+ throws IOException {
+ IntFunction<ByteBuffer> delegateAllocate = (allocate::allocate);
+ List<ParquetObjectRange> delegateRange = convertRanges(ranges);
+ delegate.readVectored(delegateRange, delegateAllocate);
+ }
+
+ private static List<ParquetObjectRange>
convertRanges(List<ParquetFileRange> ranges) {
+ return ranges.stream()
+ .map(
Review Comment:
this just maps between the internal parquet hadoop range and the new iceberg
one.
--
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]