Class AnalyticsStream
java.lang.Object
java.io.InputStream
org.apache.hadoop.fs.FSInputStream
org.apache.hadoop.fs.s3a.impl.streams.ObjectInputStream
org.apache.hadoop.fs.s3a.impl.streams.AnalyticsStream
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.fs.PositionedReadable,org.apache.hadoop.fs.Seekable,org.apache.hadoop.fs.statistics.IOStatisticsSource,org.apache.hadoop.fs.StreamCapabilities
public class AnalyticsStream
extends ObjectInputStream
implements org.apache.hadoop.fs.StreamCapabilities
Analytics stream creates a stream using aws-analytics-accelerator-s3. This stream supports
parquet specific optimisations such as parquet-aware prefetching. For more details, see
https://github.com/awslabs/analytics-accelerator-s3.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.fs.StreamCapabilities
org.apache.hadoop.fs.StreamCapabilities.StreamCapability -
Field Summary
FieldsFields inherited from interface org.apache.hadoop.fs.StreamCapabilities
ABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO, VECTOREDIO_BUFFERS_SLICED -
Constructor Summary
ConstructorsConstructorDescriptionAnalyticsStream(ObjectReadParameters parameters, software.amazon.s3.analyticsaccelerator.S3SeekableInputStreamFactory s3SeekableInputStreamFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidBrute force stream close; invoked byLeakReporter.intvoidclose()Close the stream.longgetPos()protected booleanisClosed()protected booleanProbe for stream being open.intread()intread(byte[] buf, int off, int len) intreadTail(byte[] buf, int off, int len) Reads the last n bytes from the stream into a byte buffer.voidreadVectored(List<? extends org.apache.hadoop.fs.FileRange> ranges, IntFunction<ByteBuffer> allocate) Pass toreadVectored(List, IntFunction, Consumer)with theVectoredReadUtils.LOG_BYTE_BUFFER_RELEASEDreleaser.voidreadVectored(List<? extends org.apache.hadoop.fs.FileRange> ranges, IntFunction<ByteBuffer> allocate, Consumer<ByteBuffer> release) Pass toreadVectored(List, IntFunction, Consumer)with theVectoredReadUtils.LOG_BYTE_BUFFER_RELEASEDreleaser.voidseek(long pos) booleanseekToNewSource(long l) protected voidMethods inherited from class org.apache.hadoop.fs.s3a.impl.streams.ObjectInputStream
finalize, getBoundedThreadPool, getBucket, getCallbacks, getContentLength, getContext, getInputPolicy, getIOStatistics, getKey, getObjectAttributes, getPathStr, getS3AStreamStatistics, getThreadIOStatistics, getUri, getVectoredIOContext, hasCapability, maxReadSizeForVectorReads, mergeThreadIOStatistics, minSeekForVectorReads, setInputPolicy, streamType, toStringMethods inherited from class org.apache.hadoop.fs.FSInputStream
read, readFully, readFully, validatePositionedReadArgsMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferToMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.fs.StreamCapabilities
hasCapability
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
AnalyticsStream
public AnalyticsStream(ObjectReadParameters parameters, software.amazon.s3.analyticsaccelerator.S3SeekableInputStreamFactory s3SeekableInputStreamFactory) throws IOException - Throws:
IOException
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
seek
- Specified by:
seekin interfaceorg.apache.hadoop.fs.Seekable- Specified by:
seekin classorg.apache.hadoop.fs.FSInputStream- Throws:
IOException
-
getPos
public long getPos()- Specified by:
getPosin interfaceorg.apache.hadoop.fs.Seekable- Specified by:
getPosin classorg.apache.hadoop.fs.FSInputStream
-
readTail
Reads the last n bytes from the stream into a byte buffer. Blocks until end of stream is reached. Leaves the position of the stream unaltered.- Parameters:
buf- buffer to read data intooff- start position in buffer at which data is writtenlen- the number of bytes to read; the n-th byte should be the last byte of the stream.- Returns:
- the total number of bytes read into the buffer
- Throws:
IOException- if an I/O error occurs
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
readVectored
public void readVectored(List<? extends org.apache.hadoop.fs.FileRange> ranges, IntFunction<ByteBuffer> allocate) throws IOException Pass toreadVectored(List, IntFunction, Consumer)with theVectoredReadUtils.LOG_BYTE_BUFFER_RELEASEDreleaser.- Specified by:
readVectoredin interfaceorg.apache.hadoop.fs.PositionedReadable- Throws:
IOException
-
readVectored
public void readVectored(List<? extends org.apache.hadoop.fs.FileRange> ranges, IntFunction<ByteBuffer> allocate, Consumer<ByteBuffer> release) throws IOException Pass toreadVectored(List, IntFunction, Consumer)with theVectoredReadUtils.LOG_BYTE_BUFFER_RELEASEDreleaser.- Specified by:
readVectoredin interfaceorg.apache.hadoop.fs.PositionedReadable- Throws:
IOException
-
seekToNewSource
- Specified by:
seekToNewSourcein interfaceorg.apache.hadoop.fs.Seekable- Specified by:
seekToNewSourcein classorg.apache.hadoop.fs.FSInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
isStreamOpen
protected boolean isStreamOpen()Description copied from class:ObjectInputStreamProbe for stream being open. Not synchronized; the flag is volatile.- Specified by:
isStreamOpenin classObjectInputStream- Returns:
- true if the stream is still open.
-
isClosed
protected boolean isClosed() -
abortInFinalizer
protected void abortInFinalizer()Description copied from class:ObjectInputStreamBrute force stream close; invoked byLeakReporter. All exceptions raised are ignored.- Specified by:
abortInFinalizerin classObjectInputStream
-
close
Description copied from class:ObjectInputStreamClose the stream. This triggers publishing of the stream statistics back to the filesystem statistics. This operation is synchronized, so that only one thread can attempt to- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classObjectInputStream- Throws:
IOException- on any problem
-
throwIfClosed
- Throws:
IOException
-