Package org.roaringbitmap
Class ParallelAggregation
- java.lang.Object
-
- org.roaringbitmap.ParallelAggregation
-
public class ParallelAggregation extends java.lang.Object
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 Classes Modifier and Type Class Description static class
ParallelAggregation.ContainerCollector
Collects containers grouped by their key into a RoaringBitmap, applying the supplied aggregation function to each group.static class
ParallelAggregation.OrCollector
Collects a list of containers into a single container.
-
Field Summary
Fields Modifier and Type Field Description private static ParallelAggregation.OrCollector
OR
private static java.util.stream.Collector<java.util.Map.Entry<java.lang.Character,java.util.List<Container>>,RoaringArray,RoaringBitmap>
XOR
-
Constructor Summary
Constructors Constructor Description ParallelAggregation()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
availableParallelism()
static java.util.SortedMap<java.lang.Character,java.util.List<Container>>
groupByKey(RoaringBitmap... bitmaps)
Groups the containers by their keysprivate static Container
or(java.util.List<Container> containers)
static RoaringBitmap
or(RoaringBitmap... bitmaps)
Computes the bitwise union of the input bitmapsprivate static Container
xor(java.util.List<Container> containers)
static RoaringBitmap
xor(RoaringBitmap... bitmaps)
Computes the bitwise symmetric difference of the input bitmaps
-
-
-
Field Detail
-
XOR
private static final java.util.stream.Collector<java.util.Map.Entry<java.lang.Character,java.util.List<Container>>,RoaringArray,RoaringBitmap> XOR
-
OR
private static final ParallelAggregation.OrCollector OR
-
-
Method Detail
-
groupByKey
public static java.util.SortedMap<java.lang.Character,java.util.List<Container>> groupByKey(RoaringBitmap... bitmaps)
Groups the containers by their keys- Parameters:
bitmaps
- input bitmaps- Returns:
- The containers from the bitmaps grouped by key
-
or
public static RoaringBitmap or(RoaringBitmap... bitmaps)
Computes the bitwise union of the input bitmaps- Parameters:
bitmaps
- the input bitmaps- Returns:
- the union of the bitmaps
-
xor
public static RoaringBitmap xor(RoaringBitmap... bitmaps)
Computes the bitwise symmetric difference of the input bitmaps- Parameters:
bitmaps
- the input bitmaps- Returns:
- the symmetric difference of the bitmaps
-
availableParallelism
private static int availableParallelism()
-
-