Class CompressedHeaderlessChannelReaderInputView
- java.lang.Object
-
- org.apache.flink.runtime.memory.AbstractPagedInputView
-
- org.apache.flink.runtime.io.disk.iomanager.AbstractChannelReaderInputView
-
- org.apache.flink.table.runtime.io.CompressedHeaderlessChannelReaderInputView
-
- All Implemented Interfaces:
DataInput
,DataInputView
,RequestDoneCallback<Buffer>
,BufferRecycler
public class CompressedHeaderlessChannelReaderInputView extends AbstractChannelReaderInputView implements RequestDoneCallback<Buffer>, BufferRecycler
ADataInputView
that is backed by aBufferFileReader
, making it effectively a data input stream. The view reads it data in blocks from the underlying channel and decompress it before returning to caller. The view can only read data that has been written byCompressedHeaderlessChannelWriterOutputView
, due to block formatting.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.network.buffer.BufferRecycler
BufferRecycler.DummyBufferRecycler
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.memory.AbstractPagedInputView
headerLength
-
-
Constructor Summary
Constructors Constructor Description CompressedHeaderlessChannelReaderInputView(FileIOChannel.ID id, IOManager ioManager, BlockCompressionFactory compressionCodecFactory, int compressionBlockSize, int numBlocks)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MemorySegment>
close()
Closes this InputView, closing the underlying reader and returning all memory segments.FileIOChannel
getChannel()
Get the underlying channel.protected int
getLimitForSegment(MemorySegment segment)
Gets the limit for reading bytes from the given memory segment.BufferFileReader
getReader()
boolean
isClosed()
protected MemorySegment
nextSegment(MemorySegment current)
The method by which concrete subclasses realize page crossing.void
recycle(MemorySegment segment)
Recycles theMemorySegment
to its originalBufferPool
instance.void
requestFailed(Buffer buffer, IOException e)
void
requestSuccessful(Buffer request)
-
Methods inherited from class org.apache.flink.runtime.memory.AbstractPagedInputView
advance, clear, doAdvance, getCurrentPositionInSegment, getCurrentSegment, getCurrentSegmentLimit, getHeaderLength, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seekInput, skipBytes, skipBytesToRead
-
-
-
-
Constructor Detail
-
CompressedHeaderlessChannelReaderInputView
public CompressedHeaderlessChannelReaderInputView(FileIOChannel.ID id, IOManager ioManager, BlockCompressionFactory compressionCodecFactory, int compressionBlockSize, int numBlocks) throws IOException
- Throws:
IOException
-
-
Method Detail
-
nextSegment
protected MemorySegment nextSegment(MemorySegment current) throws IOException
Description copied from class:AbstractPagedInputView
The method by which concrete subclasses realize page crossing. This method is invoked when the current page is exhausted and a new page is required to continue the reading. If no further page is available, this method must throw anEOFException
.- Specified by:
nextSegment
in classAbstractPagedInputView
- Parameters:
current
- The current page that was read to its limit. May benull
, if this method is invoked for the first time.- Returns:
- The next page from which the reading should continue. May not be
null
. If the input is exhausted, anEOFException
must be thrown instead. - Throws:
EOFException
- Thrown, if no further segment is available.IOException
- Thrown, if the method cannot provide the next page due to an I/O related problem.
-
getReader
public BufferFileReader getReader()
-
getLimitForSegment
protected int getLimitForSegment(MemorySegment segment)
Description copied from class:AbstractPagedInputView
Gets the limit for reading bytes from the given memory segment. This method must return the position of the byte after the last valid byte in the given memory segment. When the position returned by this method is reached, the view will attempt to switch to the next memory segment.- Specified by:
getLimitForSegment
in classAbstractPagedInputView
- Parameters:
segment
- The segment to determine the limit for.- Returns:
- The limit for the given memory segment.
-
close
public List<MemorySegment> close() throws IOException
Description copied from class:AbstractChannelReaderInputView
Closes this InputView, closing the underlying reader and returning all memory segments.- Specified by:
close
in classAbstractChannelReaderInputView
- Returns:
- A list containing all memory segments originally supplied to this view.
- Throws:
IOException
- Thrown, if the underlying reader could not be properly closed.
-
getChannel
public FileIOChannel getChannel()
Description copied from class:AbstractChannelReaderInputView
Get the underlying channel.- Specified by:
getChannel
in classAbstractChannelReaderInputView
-
isClosed
public boolean isClosed()
-
requestSuccessful
public void requestSuccessful(Buffer request)
- Specified by:
requestSuccessful
in interfaceRequestDoneCallback<Buffer>
-
requestFailed
public void requestFailed(Buffer buffer, IOException e)
- Specified by:
requestFailed
in interfaceRequestDoneCallback<Buffer>
-
recycle
public void recycle(MemorySegment segment)
Description copied from interface:BufferRecycler
Recycles theMemorySegment
to its originalBufferPool
instance.- Specified by:
recycle
in interfaceBufferRecycler
- Parameters:
segment
- The memory segment to be recycled.
-
-