Package org.apache.druid.query
Interface BitmapResultFactory<T>
-
- Type Parameters:
T
- the bitmap result (wrapper) type
- All Known Implementing Classes:
DefaultBitmapResultFactory
public interface BitmapResultFactory<T>
BitmapResultFactory is an abstraction that allows to record something along with preFilter bitmap construction, and emit this information as dimension(s) of query metrics. BitmapResultFactory is similar toBitmapFactory
: it has the same methods with the exception that it accepts generic type T (bitmap wrapper type) instead ofImmutableBitmap
.DefaultBitmapResultFactory
is a no-op implementation, where "wrapper" type isImmutableBitmap
itself. BitmapResultFactory delegates actual operations on bitmaps to aBitmapFactory
, which it accepts in constructor, called fromQueryMetrics.makeBitmapResultFactory(BitmapFactory)
. Emitting of query metric dimension(s) should be done fromtoImmutableBitmap(Object)
, the "unwrapping" method, called only once to obtain the final preFilter bitmap. Implementors expectations ------------------------- BitmapResultFactory is a part of theQueryMetrics
subsystem, so this interface could be changed often, in every Druid release (including "patch" releases). Users who create their custom implementations of BitmapResultFactory should be ready to fix the code of their code to accommodate interface changes (e. g. implement new methods) when they update Druid. SeeQueryMetrics
Javadoc for more info.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
complement(T bitmapResult, int numRows)
Delegates toBitmapFactory.complement(ImmutableBitmap, int)
on the wrapped bitmap, and returns a bitmap result wrapping the resulting complement ImmutableBitmap.T
intersection(Iterable<T> bitmapResults)
Delegates toBitmapFactory.intersection(Iterable)
on the wrapped bitmaps, and returns a bitmap result wrapping the resulting intersection ImmutableBitmap.boolean
isEmpty(T bitmapResult)
Checks that the wrapped bitmap is empty, seeImmutableBitmap.isEmpty()
.ImmutableBitmap
toImmutableBitmap(T bitmapResult)
Unwraps bitmapResult back to ImmutableBitmap.T
union(Iterable<T> bitmapResults)
Delegates toBitmapFactory.union(Iterable)
on the wrapped bitmaps, and returns a bitmap result wrapping the resulting union ImmutableBitmap.T
unionDimensionValueBitmaps(Iterable<ImmutableBitmap> dimensionValueBitmaps)
Equivalent of intersection(Iterables.transform(dimensionValueBitmaps, factory::wrapDimensionValue)), but doesn't create a lot of bitmap result objects.T
wrapAllFalse(ImmutableBitmap allFalseBitmap)
Wraps a bitmap which is a result ofBitmapFactory.makeEmptyImmutableBitmap()
call.T
wrapAllTrue(ImmutableBitmap allTrueBitmap)
Wraps a bitmap which is a result ofBitmapFactory.complement(ImmutableBitmap, int)
called withBitmapFactory.makeEmptyImmutableBitmap()
as argument.T
wrapDimensionValue(ImmutableBitmap bitmap)
Wraps a bitmap which designates rows in a segment with some specific dimension value.
-
-
-
Method Detail
-
wrapDimensionValue
T wrapDimensionValue(ImmutableBitmap bitmap)
Wraps a bitmap which designates rows in a segment with some specific dimension value.
-
wrapAllFalse
T wrapAllFalse(ImmutableBitmap allFalseBitmap)
Wraps a bitmap which is a result ofBitmapFactory.makeEmptyImmutableBitmap()
call.
-
wrapAllTrue
T wrapAllTrue(ImmutableBitmap allTrueBitmap)
Wraps a bitmap which is a result ofBitmapFactory.complement(ImmutableBitmap, int)
called withBitmapFactory.makeEmptyImmutableBitmap()
as argument.
-
isEmpty
boolean isEmpty(T bitmapResult)
Checks that the wrapped bitmap is empty, seeImmutableBitmap.isEmpty()
.
-
intersection
T intersection(Iterable<T> bitmapResults)
Delegates toBitmapFactory.intersection(Iterable)
on the wrapped bitmaps, and returns a bitmap result wrapping the resulting intersection ImmutableBitmap.
-
union
T union(Iterable<T> bitmapResults)
Delegates toBitmapFactory.union(Iterable)
on the wrapped bitmaps, and returns a bitmap result wrapping the resulting union ImmutableBitmap.
-
unionDimensionValueBitmaps
T unionDimensionValueBitmaps(Iterable<ImmutableBitmap> dimensionValueBitmaps)
Equivalent of intersection(Iterables.transform(dimensionValueBitmaps, factory::wrapDimensionValue)), but doesn't create a lot of bitmap result objects.
-
complement
T complement(T bitmapResult, int numRows)
Delegates toBitmapFactory.complement(ImmutableBitmap, int)
on the wrapped bitmap, and returns a bitmap result wrapping the resulting complement ImmutableBitmap.
-
toImmutableBitmap
ImmutableBitmap toImmutableBitmap(T bitmapResult)
Unwraps bitmapResult back to ImmutableBitmap. BitmapResultFactory should emit query metric dimension(s) in the implementation of this method.
-
-