Class BitmapRandomBuilder
java.lang.Object
io.deephaven.engine.table.impl.by.BitmapRandomBuilder
- All Implemented Interfaces:
RowSetBuilderRandom
The output RowSet of an aggregation is fairly special. It is always from zero to the number of output rows, and while
modifying states we randomly add rows to it, potentially touching the same state many times. The normal index random
builder does not guarantee those values are de-duplicated and requires O(lg n) operations for each insertion and
building the RowSet.
This version is O(1) for updating a modified slot, then linear in the number of output positions (not the number of result values) to build the RowSet. The memory usage is 1 bit per output position, vs. the standard builder is 128 bits per used value (though with the possibility of collapsing adjacent ranges when they are modified back-to-back). For random access patterns, this version will be more efficient; for friendly patterns the default random builder is likely more efficient.
We also know that we will only modify the rows that existed when we start, so that we can clamp the maximum key for the builder to the maximum output position without loss of fidelity.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.rowset.RowSetBuilderRandom
RowSetBuilderRandom.Helper
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.engine.rowset.RowSetBuilderRandom
addKeys, addOrderedRowKeysChunk, addOrderedRowKeysChunk, addOrderedRowKeysChunk, addRanges, addRowKeysChunk, addRowKeysChunk, addRowSet
-
Constructor Details
-
BitmapRandomBuilder
public BitmapRandomBuilder(int maxKey)
-
-
Method Details
-
build
- Specified by:
build
in interfaceRowSetBuilderRandom
-
addKey
public void addKey(long rowKey) - Specified by:
addKey
in interfaceRowSetBuilderRandom
-
addRange
public void addRange(long firstRowKey, long lastRowKey) - Specified by:
addRange
in interfaceRowSetBuilderRandom
-