public abstract class BinaryIndexedSortable extends Object implements IndexedSortable
Modifier and Type | Field and Description |
---|---|
protected int |
currentSortIndexOffset |
protected MemorySegment |
currentSortIndexSegment |
protected int |
indexEntrySize |
protected int |
lastIndexEntryOffset |
protected MemorySegmentPool |
memorySegmentPool |
protected int |
numRecords |
static int |
OFFSET_LEN |
protected RandomAccessInputView |
recordBuffer |
protected BinaryRowData |
row1 |
protected BinaryRowDataSerializer |
serializer |
protected BinaryRowDataSerializer |
serializer1 |
protected ArrayList<MemorySegment> |
sortIndex |
Constructor and Description |
---|
BinaryIndexedSortable(NormalizedKeyComputer normalizedKeyComputer,
BinaryRowDataSerializer serializer,
RecordComparator comparator,
ArrayList<MemorySegment> recordBufferSegments,
MemorySegmentPool memorySegmentPool) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkNextIndexOffset()
check if we need request next index 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) . |
protected MemorySegment |
nextMemorySegment() |
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.
|
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.
|
protected void |
writeIndexAndNormalizedKey(RowData record,
long currOffset)
Write of index and normalizedKey.
|
void |
writeToOutput(AbstractPagedOutputView output)
Spill: Write all records to a
AbstractPagedOutputView . |
public static final int OFFSET_LEN
protected final BinaryRowDataSerializer serializer
protected final RandomAccessInputView recordBuffer
protected MemorySegment currentSortIndexSegment
protected final MemorySegmentPool memorySegmentPool
protected final ArrayList<MemorySegment> sortIndex
protected final int indexEntrySize
protected final int lastIndexEntryOffset
protected final BinaryRowDataSerializer serializer1
protected final BinaryRowData row1
protected int currentSortIndexOffset
protected int numRecords
public BinaryIndexedSortable(NormalizedKeyComputer normalizedKeyComputer, BinaryRowDataSerializer serializer, RecordComparator comparator, ArrayList<MemorySegment> recordBufferSegments, MemorySegmentPool memorySegmentPool)
protected MemorySegment nextMemorySegment()
protected boolean checkNextIndexOffset()
protected void writeIndexAndNormalizedKey(RowData record, long currOffset)
public int compare(int i, int j)
IndexedSortable
Comparator.compare(Object, Object)
.compare
in interface IndexedSortable
public int compare(int segmentNumberI, int segmentOffsetI, int segmentNumberJ, int segmentOffsetJ)
IndexedSortable
Comparator.compare(Object, Object)
.compare
in interface IndexedSortable
segmentNumberI
- 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)
IndexedSortable
swap
in interface IndexedSortable
public void swap(int segmentNumberI, int segmentOffsetI, int segmentNumberJ, int segmentOffsetJ)
IndexedSortable
swap
in interface IndexedSortable
segmentNumberI
- 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()
IndexedSortable
size
in interface IndexedSortable
public int recordSize()
IndexedSortable
recordSize
in interface IndexedSortable
public int recordsPerSegment()
IndexedSortable
recordsPerSegment
in interface IndexedSortable
public void writeToOutput(AbstractPagedOutputView output) throws IOException
AbstractPagedOutputView
.IOException
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.