Package org.roaringbitmap
Class ParallelAggregation
java.lang.Object
org.roaringbitmap.ParallelAggregation
These utility methods provide parallel implementations of
logical aggregation operators. AND is not implemented
because it is unlikely to be profitable.
There is a temporary memory overhead in using these methods,
since a materialisation of the rotated containers grouped by key
is created in each case.
Each method executes on the default fork join pool by default.
If this is undesirable (it usually is) wrap the call inside
a submission of a runnable to your own thread pool.
//...
ExecutorService executor = ...
RoaringBitmap[] bitmaps = ...
// executes on executors threads
RoaringBitmap result = executor.submit(() -> ParallelAggregation.or(bitmaps)).get();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Collects containers grouped by their key into a RoaringBitmap, applying the supplied aggregation function to each group.static class
Collects a list of containers into a single container. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ParallelAggregation.OrCollector
private static final Collector
<Map.Entry<Character, List<Container>>, RoaringArray, RoaringBitmap> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
groupByKey
(RoaringBitmap... bitmaps) Groups the containers by their keysprivate static Container
static RoaringBitmap
or
(RoaringBitmap... bitmaps) Computes the bitwise union of the input bitmapsprivate static Container
static RoaringBitmap
xor
(RoaringBitmap... bitmaps) Computes the bitwise symmetric difference of the input bitmaps
-
Field Details
-
XOR
-
OR
-
-
Constructor Details
-
ParallelAggregation
public ParallelAggregation()
-
-
Method Details
-
groupByKey
Groups the containers by their keys- Parameters:
bitmaps
- input bitmaps- Returns:
- The containers from the bitmaps grouped by key
-
or
Computes the bitwise union of the input bitmaps- Parameters:
bitmaps
- the input bitmaps- Returns:
- the union of the bitmaps
-
xor
Computes the bitwise symmetric difference of the input bitmaps- Parameters:
bitmaps
- the input bitmaps- Returns:
- the symmetric difference of the bitmaps
-
xor
-
or
-
availableParallelism
private static int availableParallelism()
-