Class LongHashPartition
- java.lang.Object
-
- org.apache.flink.runtime.memory.AbstractPagedInputView
-
- org.apache.flink.table.runtime.hashtable.LongHashPartition
-
- All Implemented Interfaces:
DataInput
,DataInputView
,SeekableDataInputView
public class LongHashPartition extends AbstractPagedInputView implements SeekableDataInputView
Partition forLongHybridHashTable
.The layout of the buckets inside a memory segment is as follows:
Hash mode: +----------------------------- Bucket area ---------------------------- | long key (8 bytes) | address (8 bytes) | | long key (8 bytes) | address (8 bytes) | | long key (8 bytes) | address (8 bytes) | | ... +----------------------------- Data area -------------------------- | size & address of next row with the same key (8bytes) | binary row | | size & address of next row with the same key (8bytes) | binary row | | size & address of next row with the same key (8bytes) | binary row | | ...
Dense mode: +----------------------------- Bucket area ---------------------------- | address1 (8 bytes) | address2 (8 bytes) | address3 (8 bytes) | ... Directly addressed by the index of the corresponding array of key values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
LongHashPartition.MatchIterator
Iterator for probe match.
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.memory.AbstractPagedInputView
headerLength
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
deserializeFromPages(BinaryRowData reuse, ChannelReaderInputView inView, BinaryRowDataSerializer buildSideSerializer)
LongHashPartition.MatchIterator
get(long key, int hashCode)
Returns an iterator for all the values for the given key, or null if no value found.MemorySegment[]
getBuckets()
protected int
getLimitForSegment(MemorySegment segment)
Gets the limit for reading bytes from the given memory segment.protected MemorySegment
nextSegment(MemorySegment current)
The method by which concrete subclasses realize page crossing.void
serializeToPages(BinaryRowData row)
void
setReadPosition(long pointer)
Sets the read pointer to the given position.-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
-
Methods inherited from interface org.apache.flink.core.memory.DataInputView
read, read, skipBytesToRead
-
-
-
-
Method Detail
-
get
public LongHashPartition.MatchIterator get(long key, int hashCode)
Returns an iterator for all the values for the given key, or null if no value found.
-
getBuckets
public MemorySegment[] getBuckets()
-
setReadPosition
public void setReadPosition(long pointer)
Description copied from interface:SeekableDataInputView
Sets the read pointer to the given position.- Specified by:
setReadPosition
in interfaceSeekableDataInputView
- Parameters:
pointer
- The new read position.
-
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.
-
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.
-
serializeToPages
public void serializeToPages(BinaryRowData row) throws IOException
- Throws:
IOException
-
deserializeFromPages
public static void deserializeFromPages(BinaryRowData reuse, ChannelReaderInputView inView, BinaryRowDataSerializer buildSideSerializer) throws IOException
- Throws:
IOException
-
-