public final class FixedLengthRecordSorter<T> extends Object implements InMemorySorter<T>
| Constructor and Description |
|---|
FixedLengthRecordSorter(TypeSerializer<T> serializer,
TypeComparator<T> comparator,
List<MemorySegment> memory) |
| 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). |
List<MemorySegment> |
dispose()
Collects all memory segments from this sorter.
|
long |
getCapacity()
Gets the total capacity of this sorter, in bytes.
|
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.
|
T |
getRecord(T reuse,
int logicalPosition)
Gets the record at the given logical position.
|
boolean |
isEmpty()
Checks whether the buffer is empty.
|
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.
|
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.
|
public FixedLengthRecordSorter(TypeSerializer<T> serializer, TypeComparator<T> comparator, List<MemorySegment> memory)
public void reset()
reset in interface InMemorySorter<T>public boolean isEmpty()
isEmpty in interface InMemorySorter<T>public List<MemorySegment> dispose()
dispose in interface InMemorySorter<T>public long getCapacity()
getCapacity in interface InMemorySorter<T>public long getOccupancy()
getOccupancy in interface InMemorySorter<T>public T getRecord(T reuse, int logicalPosition) throws IOException
getRecord 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 void swap(int i,
int j)
IndexedSortableswap in interface IndexedSortablepublic int size()
IndexedSortablesize in interface IndexedSortablepublic final 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, 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 The Apache Software Foundation. All rights reserved.