public final class VectorIoBridge extends Object
This loads the PositionedReadable method:
void readVectored(List[?extends FileRange] ranges,
IntFunction[ByteBuffer] allocate) throws IOException
It is made slightly easier because of type erasure; the signature of the
function is actually Void.class method(List.class, IntFunction.class).
There are some counters to aid in testing; the toString() method
will print them and the loaded method, for use in tests and debug logs.
| Modifier and Type | Method and Description |
|---|---|
boolean |
available()
Is the bridge available?
|
static VectorIoBridge |
availableInstance()
Get the instance verifying that the API is available.
|
static boolean |
bridgeAvailable()
Is the bridge available for use?
|
long |
getBlocksRead()
How many blocks were read?
|
long |
getBytesRead()
How many bytes of data have been read.
|
long |
getVectorReads()
How many vector read calls have been made?
|
boolean |
hasCapability(org.apache.hadoop.fs.FSDataInputStream stream,
String capability)
Does a stream implement StreamCapability and, if so, is the capability
available.
|
static VectorIoBridge |
instance()
Get the singleton instance.
|
boolean |
readVectoredAvailable(org.apache.hadoop.fs.FSDataInputStream stream,
ByteBufferAllocator allocator)
Is the vectored IO API available for the given stream
and allocator in this Hadoop runtime?
|
void |
readVectoredRanges(org.apache.hadoop.fs.FSDataInputStream stream,
List<ParquetFileRange> ranges,
ByteBufferAllocator allocator)
Read fully a list of file ranges asynchronously from this file.
|
String |
toString() |
public boolean readVectoredAvailable(org.apache.hadoop.fs.FSDataInputStream stream,
ByteBufferAllocator allocator)
stream - input stream to query.allocator - allocator to be used.public boolean available()
public void readVectoredRanges(org.apache.hadoop.fs.FSDataInputStream stream,
List<ParquetFileRange> ranges,
ByteBufferAllocator allocator)
throws IOException
ParquetFileRange parameters all have their
data read futures set to the range reads of the associated
operations; callers must await these to complete.
As a result of the call, each range will have FileRange.setData(CompletableFuture) called with a future that when complete will have a ByteBuffer with the data from the file's range.
The position returned by getPos() after readVectored() is undefined.
If a file is changed while the readVectored() operation is in progress, the output is undefined. Some ranges may have old data, some may have new and some may have both.
While a readVectored() operation is in progress, normal read api calls may block.
stream - stream from where the data has to be read.ranges - parquet file ranges.allocator - buffer allocator.UnsupportedOperationException - if the API is not available.EOFException - if a range is past the known end of the file.IOException - any IO problem initiating the read operations.IllegalArgumentException - if there are overlapping ranges or
a range element is invalidpublic boolean hasCapability(org.apache.hadoop.fs.FSDataInputStream stream,
String capability)
stream - input stream to query.capability - the capability to look for.public long getVectorReads()
public long getBlocksRead()
public long getBytesRead()
public static VectorIoBridge instance()
public static boolean bridgeAvailable()
public static VectorIoBridge availableInstance()
UnsupportedOperationException - if it is not.Copyright © 2023 The Apache Software Foundation. All rights reserved.