Interface FindRunsKernel
public interface FindRunsKernel
-
Method Summary
Modifier and TypeMethodDescriptionint
compactRuns
(@NotNull WritableChunk<? extends Any> sortedValues, @NotNull IntChunk<ChunkPositions> offsetsIn) Compact already-found runs insortedValues
according to the offsets inoffsetsIn
.void
findRuns
(@NotNull Chunk<? extends Any> sortedValues, @NotNull IntChunk<ChunkPositions> offsetsIn, @NotNull IntChunk<ChunkLengths> lengthsIn, @NotNull WritableIntChunk<ChunkPositions> offsetsOut, @NotNull WritableIntChunk<ChunkLengths> lengthsOut) Find runs of identical values in a sorted chunk.void
findRuns
(@NotNull Chunk<? extends Any> sortedValues, @NotNull WritableIntChunk<ChunkPositions> offsetsOut, @NotNull WritableIntChunk<ChunkLengths> lengthsOut) Find runs of identical values in a sorted chunk.void
findRunsSingles
(@NotNull Chunk<? extends Any> sortedValues, @NotNull WritableIntChunk<ChunkPositions> offsetsOut, @NotNull WritableIntChunk<ChunkLengths> lengthsOut) Find runs of identical values in a sorted chunk.static FindRunsKernel
getInstance
(ChunkType chunkType)
-
Method Details
-
getInstance
-
findRuns
void findRuns(@NotNull @NotNull Chunk<? extends Any> sortedValues, @NotNull @NotNull WritableIntChunk<ChunkPositions> offsetsOut, @NotNull @NotNull WritableIntChunk<ChunkLengths> lengthsOut) Find runs of identical values in a sorted chunk. This is used as part of an overall sort, after the timsort (or other sorting) kernel to identify the runs that must be sorted according to secondary keys.Runs with only a single value are not included.
- Parameters:
sortedValues
- a chunk of sorted valuesoffsetsOut
- an output chunk, with offsets of starting locations that a run occurredlengthsOut
- an output chunk, parallel to offsetsOut, with the lengths of found runs
-
findRunsSingles
void findRunsSingles(@NotNull @NotNull Chunk<? extends Any> sortedValues, @NotNull @NotNull WritableIntChunk<ChunkPositions> offsetsOut, @NotNull @NotNull WritableIntChunk<ChunkLengths> lengthsOut) Find runs of identical values in a sorted chunk.Runs of a single values are included.
- Parameters:
sortedValues
- a chunk of sorted valuesoffsetsOut
- an output chunk, with offsets of starting locations that a run occurredlengthsOut
- an output chunk, parallel to offsetsOut, with the lengths of found runs
-
findRuns
void findRuns(@NotNull @NotNull Chunk<? extends Any> sortedValues, @NotNull @NotNull IntChunk<ChunkPositions> offsetsIn, @NotNull @NotNull IntChunk<ChunkLengths> lengthsIn, @NotNull @NotNull WritableIntChunk<ChunkPositions> offsetsOut, @NotNull @NotNull WritableIntChunk<ChunkLengths> lengthsOut) Find runs of identical values in a sorted chunk. This is used as part of an overall sort, after the timsort (or other sorting) kernel to identify the runs that must be sorted according to secondary keys.- Parameters:
sortedValues
- a chunk of sorted valuesoffsetsIn
- the offsets within the chunk to check for runslengthsIn
- the lengths parallel to offsetsIn for run checkingoffsetsOut
- an output chunk, with offsets of starting locations that a run occurredlengthsOut
- an output chunk, parallel to offsetsOut, with the lengths of found runs Note, that lengthsIn must contain values greater than 1, and lengthsOut additionally only contain values greater than one
-
compactRuns
int compactRuns(@NotNull @NotNull WritableChunk<? extends Any> sortedValues, @NotNull @NotNull IntChunk<ChunkPositions> offsetsIn) Compact already-found runs insortedValues
according to the offsets inoffsetsIn
.Additionally, verify that the elements are properly ordered; returning the first position of an out-of-order element.
- Parameters:
sortedValues
- The chunk of runs to compactoffsetsIn
- The start offsets for each run insortedValues
- Returns:
- The first position of an out-of-order element, or -1 if all elements are in order
-