public final class FixedLengthRecordSorter<T> extends Object implements InMemorySorter<T>
| 构造器和说明 |
|---|
FixedLengthRecordSorter(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 |
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 int recordSize()
IndexedSortablerecordSize 在接口中 IndexedSortablepublic int recordsPerSegment()
IndexedSortablerecordsPerSegment 在接口中 IndexedSortablepublic void reset()
reset 在接口中 InMemorySorter<T>public boolean isEmpty()
isEmpty 在接口中 InMemorySorter<T>public void dispose()
InMemorySorterdispose 在接口中 InMemorySorter<T>dispose 在接口中 org.apache.flink.util.Disposablepublic long getCapacity()
InMemorySortergetCapacity 在接口中 InMemorySorter<T>public long getOccupancy()
InMemorySortergetOccupancy 在接口中 InMemorySorter<T>public T getRecord(int logicalPosition) throws IOException
InMemorySortergetRecord 在接口中 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 在接口中 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 在接口中 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 在接口中 IndexedSortablepublic int compare(int segmentNumberI,
int segmentOffsetI,
int segmentNumberJ,
int segmentOffsetJ)
IndexedSortableComparator.compare(Object, Object).compare 在接口中 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 在接口中 IndexedSortablepublic void swap(int segmentNumberI,
int segmentOffsetI,
int segmentNumberJ,
int segmentOffsetJ)
IndexedSortableswap 在接口中 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 在接口中 IndexedSortablepublic final org.apache.flink.util.MutableObjectIterator<T> getIterator()
getIterator 在接口中 InMemorySorter<T>public void writeToOutput(ChannelWriterOutputView output) throws IOException
writeToOutput 在接口中 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 在接口中 InMemorySorter<T>IOExceptionpublic void writeToOutput(ChannelWriterOutputView output, int start, int num) throws IOException
writeToOutput 在接口中 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–2022 The Apache Software Foundation. All rights reserved.