public final class NormalizedKeySorter<T> extends Object implements InMemorySorter<T>
| Constructor and Description |
|---|
NormalizedKeySorter(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer,
org.apache.flink.api.common.typeutils.TypeComparator<T> comparator,
List<org.apache.flink.core.memory.MemorySegment> memory) |
NormalizedKeySorter(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer,
org.apache.flink.api.common.typeutils.TypeComparator<T> comparator,
List<org.apache.flink.core.memory.MemorySegment> memory,
int maxNormalizedKeyBytes) |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(int i,
int j)
Compare items at the given addresses consistent with the semantics of
Comparator.compare(Object, Object). |
int |
compare(int segmentNumberI,
int segmentOffsetI,
int segmentNumberJ,
int segmentOffsetJ)
Compare records at the given addresses consistent with the semantics of
Comparator.compare(Object, Object). |
void |
dispose()
Disposes the sorter.
|
long |
getCapacity()
Gets the total capacity of this sorter, in bytes.
|
org.apache.flink.util.MutableObjectIterator<T> |
getIterator()
Gets an iterator over all records in this buffer in their logical order.
|
long |
getOccupancy()
Gets the number of bytes currently occupied in this sorter, records and sort index.
|
T |
getRecord(int logicalPosition)
Gets the record at the given logical position.
|
T |
getRecord(T reuse,
int logicalPosition)
Gets the record at the given logical position.
|
boolean |
isEmpty()
Checks whether the buffer is empty.
|
int |
recordSize()
Gets the size of each record, the number of bytes separating the head of successive records.
|
int |
recordsPerSegment()
Gets the number of elements in each memory segment.
|
void |
reset()
Resets the sort buffer back to the state where it is empty.
|
int |
size()
Gets the number of elements in the sortable.
|
void |
swap(int i,
int j)
Swap items at the given addresses.
|
void |
swap(int segmentNumberI,
int segmentOffsetI,
int segmentNumberJ,
int segmentOffsetJ)
Swap records at the given addresses.
|
boolean |
write(T record)
Writes a given record to this sort buffer.
|
void |
writeToOutput(ChannelWriterOutputView output)
Writes the records in this buffer in their logical order to the given output.
|
void |
writeToOutput(ChannelWriterOutputView output,
int start,
int num)
Writes a subset of the records in this buffer in their logical order to the given output.
|
void |
writeToOutput(ChannelWriterOutputView output,
LargeRecordHandler<T> largeRecordsOutput) |
public NormalizedKeySorter(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer, org.apache.flink.api.common.typeutils.TypeComparator<T> comparator, List<org.apache.flink.core.memory.MemorySegment> memory)
public int recordSize()
IndexedSortablerecordSize in interface IndexedSortablepublic int recordsPerSegment()
IndexedSortablerecordsPerSegment in interface IndexedSortablepublic void reset()
reset in interface InMemorySorter<T>public boolean isEmpty()
isEmpty in interface InMemorySorter<T>public void dispose()
InMemorySorterdispose in interface InMemorySorter<T>dispose in interface org.apache.flink.util.Disposablepublic long getCapacity()
InMemorySortergetCapacity in interface InMemorySorter<T>public long getOccupancy()
InMemorySortergetOccupancy in interface InMemorySorter<T>public T getRecord(int logicalPosition) throws IOException
InMemorySortergetRecord in interface InMemorySorter<T>logicalPosition - The logical position of the record.IOException - Thrown, if an exception occurred during deserialization.public T getRecord(T reuse, int logicalPosition) throws IOException
InMemorySortergetRecord in interface InMemorySorter<T>reuse - The reuse object to deserialize the record into.logicalPosition - The logical position of the record.IOException - Thrown, if an exception occurred during deserialization.public boolean write(T record) throws IOException
write in interface InMemorySorter<T>record - The record to be written.IOException - Thrown, if an error occurred while serializing the record into the
buffers.public int compare(int i,
int j)
IndexedSortableComparator.compare(Object, Object).compare in interface IndexedSortablepublic int compare(int segmentNumberI,
int segmentOffsetI,
int segmentNumberJ,
int segmentOffsetJ)
IndexedSortableComparator.compare(Object, Object).compare in interface IndexedSortablesegmentNumberI - index of memory segment containing first recordsegmentOffsetI - offset into memory segment containing first recordsegmentNumberJ - index of memory segment containing second recordsegmentOffsetJ - offset into memory segment containing second recordpublic void swap(int i,
int j)
IndexedSortableswap in interface IndexedSortablepublic void swap(int segmentNumberI,
int segmentOffsetI,
int segmentNumberJ,
int segmentOffsetJ)
IndexedSortableswap in interface IndexedSortablesegmentNumberI - index of memory segment containing first recordsegmentOffsetI - offset into memory segment containing first recordsegmentNumberJ - index of memory segment containing second recordsegmentOffsetJ - offset into memory segment containing second recordpublic int size()
IndexedSortablesize in interface IndexedSortablepublic final org.apache.flink.util.MutableObjectIterator<T> getIterator()
getIterator in interface InMemorySorter<T>public void writeToOutput(ChannelWriterOutputView output) throws IOException
writeToOutput in interface InMemorySorter<T>output - The output view to write the records to.IOException - Thrown, if an I/O exception occurred writing to the output view.public void writeToOutput(ChannelWriterOutputView output, LargeRecordHandler<T> largeRecordsOutput) throws IOException
writeToOutput in interface InMemorySorter<T>IOExceptionpublic void writeToOutput(ChannelWriterOutputView output, int start, int num) throws IOException
writeToOutput in interface InMemorySorter<T>output - The output view to write the records to.start - The logical start position of the subset.num - The number of elements to write.IOException - Thrown, if an I/O exception occurred writing to the output view.Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.