Interface CompactKernel
- All Known Implementing Classes:
BooleanCompactKernel,ByteCompactKernel,CharCompactKernel,DoubleCompactKernel,EqualsConsistentObjectCompactKernel,FloatCompactKernel,IntCompactKernel,LongCompactKernel,ObjectCompactKernel,ShortCompactKernel
public interface CompactKernel
-
Method Summary
Modifier and TypeMethodDescriptionvoidcompact(WritableChunk<? extends Any> values, BooleanChunk<Any> retainValues) Compacts values into the front of the chunk, retaining only values where the parallel retainValues chunk has a true value.default voidcompactAndCount(WritableChunk<? extends Values> valueChunk, WritableIntChunk<ChunkLengths> counts) Sort valuesChunk, eliminate duplicates, and write the number of times a value occurred into the parallel slot within counts.voidcompactAndCount(WritableChunk<? extends Values> valueChunk, WritableIntChunk<ChunkLengths> counts, boolean countNull, boolean countNaN) Sort valuesChunk, eliminate duplicates, and write the number of times a value occurred into the parallel slot within counts.default voidcompactAndCount(WritableChunk<? extends Values> valueChunk, WritableIntChunk<ChunkLengths> counts, IntChunk<ChunkPositions> startPositions, WritableIntChunk<ChunkLengths> lengths) For each run in valuesChunk, sort it, eliminate duplicates, and write the number of times a value occurred into the parallel slot within counts.voidcompactAndCount(WritableChunk<? extends Values> valueChunk, WritableIntChunk<ChunkLengths> counts, IntChunk<ChunkPositions> startPositions, WritableIntChunk<ChunkLengths> lengths, boolean countNull, boolean countNaN) For each run in valuesChunk, sort it, eliminate duplicates, and write the number of times a value occurred into the parallel slot within counts.static CompactKernelmakeCompact(ChunkType chunkType, boolean equalsConsistent) Make a CompactKernel for values of the given type.
-
Method Details
-
compact
Compacts values into the front of the chunk, retaining only values where the parallel retainValues chunk has a true value. The chunk's size is set to the number of retained values.- Parameters:
values- a chunk of values, input and outputretainValues- the values to retain
-
compactAndCount
default void compactAndCount(WritableChunk<? extends Values> valueChunk, WritableIntChunk<ChunkLengths> counts) Sort valuesChunk, eliminate duplicates, and write the number of times a value occurred into the parallel slot within counts. null/NaN values are removed from the chunk.- Parameters:
valueChunk- a chunk of values, input and outputcounts- an output chunk parallel to valueChunk with the number of times a value occurred
-
compactAndCount
void compactAndCount(WritableChunk<? extends Values> valueChunk, WritableIntChunk<ChunkLengths> counts, boolean countNull, boolean countNaN) Sort valuesChunk, eliminate duplicates, and write the number of times a value occurred into the parallel slot within counts.- Parameters:
valueChunk- a chunk of values, input and outputcounts- an output chunk parallel to valueChunk with the number of times a value occurredcountNull- if the compaction should count nulls or notcountNaN- if the compaction should count NaN or not (only applies to float/double)
-
compactAndCount
default void compactAndCount(WritableChunk<? extends Values> valueChunk, WritableIntChunk<ChunkLengths> counts, IntChunk<ChunkPositions> startPositions, WritableIntChunk<ChunkLengths> lengths) For each run in valuesChunk, sort it, eliminate duplicates, and write the number of times a value occurred into the parallel slot within counts. null/NaN values are removed from the chunk.- Parameters:
valueChunk- a chunk of values, input and outputcounts- an output chunk parallel to valueChunk with the number of times a value occurredstartPositions- the start of each runlengths- the length of each run, input and output
-
compactAndCount
void compactAndCount(WritableChunk<? extends Values> valueChunk, WritableIntChunk<ChunkLengths> counts, IntChunk<ChunkPositions> startPositions, WritableIntChunk<ChunkLengths> lengths, boolean countNull, boolean countNaN) For each run in valuesChunk, sort it, eliminate duplicates, and write the number of times a value occurred into the parallel slot within counts.- Parameters:
valueChunk- a chunk of values, input and outputcounts- an output chunk parallel to valueChunk with the number of times a value occurredstartPositions- the start of each runlengths- the length of each run, input and outputcountNull- if the compaction should count nulls or notcountNaN- if the compaction should count NaN or not (only applies to float/double)
-
makeCompact
Make a CompactKernel for values of the given type. Sorted operations pass the decision for their data type, so the kernel'scompactAndCountequality is consistent with the ordering of the values; hash-based operations, whose key equality must be consistent withhashCode, passtrue.- Parameters:
chunkType- the chunk type of the valuesequalsConsistent- true when values of the data type compare equal exactly when they are equal (seeBinarySearchKernelHelper.compareConsistentWithEquality(Class)), which selects the EqualsConsistentObject kernel whosecompactAndCounttests Object equality withequals; when false, Object equality is tested withObjectComparisons.compareEquals(Object, Object). Other chunk types ignore it. An operation reads the registry once and passes the same decision to every kernel it creates, so its kernels come from one family.- Returns:
- the CompactKernel
-