Package org.apache.druid.segment.index
Class DictionaryScanningBitmapIndex
- java.lang.Object
-
- org.apache.druid.segment.index.SimpleBitmapColumnIndex
-
- org.apache.druid.segment.index.SimpleImmutableBitmapIterableIndex
-
- org.apache.druid.segment.index.DictionaryScanningBitmapIndex
-
- All Implemented Interfaces:
BitmapColumnIndex
public abstract class DictionaryScanningBitmapIndex extends SimpleImmutableBitmapIterableIndex
CommonBitmapColumnIndeximplementation for indexes which are computed by scanning the entire value dictionary of the underlying column to check if the value index matches the filter. Contains logic to skip computing indexes withcomputeBitmapResult(BitmapResultFactory, int, int, boolean)if 'selectionRowCount' does not equal 'totalRowCount' and 'selectionRowCount' is smaller thandictionarySizemultiplied byscaleThreshold. The defaultscaleThresholdvalue is 1.0, meaning that ifdictionarySizeis larger than 'selectionRowCount' we skip using indexes, the idea being we would either have to perform the check against the values in the dictionary or the values in the remaining rows, since remaining rows is smaller we should just do that instead of spending time to compute indexes to further shrink 'selectionRowCount'.
-
-
Field Summary
-
Fields inherited from class org.apache.druid.segment.index.SimpleBitmapColumnIndex
CAPABILITIES
-
-
Constructor Summary
Constructors Constructor Description DictionaryScanningBitmapIndex(int dictionarySize)DictionaryScanningBitmapIndex(int dictionarySize, double scaleThreshold)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TcomputeBitmapResult(BitmapResultFactory<T> bitmapResultFactory, int applyRowCount, int totalRowCount, boolean includeUnknown)Compute a bitmap result wrapped with theBitmapResultFactoryrepresenting the rows matched by this index, or null if the index cannot (or should not) be computed.-
Methods inherited from class org.apache.druid.segment.index.SimpleImmutableBitmapIterableIndex
computeBitmapResult, getBitmapIterable
-
Methods inherited from class org.apache.druid.segment.index.SimpleBitmapColumnIndex
getIndexCapabilities
-
-
-
-
Method Detail
-
computeBitmapResult
@Nullable public final <T> T computeBitmapResult(BitmapResultFactory<T> bitmapResultFactory, int applyRowCount, int totalRowCount, boolean includeUnknown)
Description copied from interface:BitmapColumnIndexCompute a bitmap result wrapped with theBitmapResultFactoryrepresenting the rows matched by this index, or null if the index cannot (or should not) be computed.- Parameters:
bitmapResultFactory- helper to format theImmutableBitmapin a form ready for consumption by callersapplyRowCount- upper bound on number of rows this filter would be applied to, after removing rows short-circuited by prior bundle operations. For example, given "x AND y", if "x" is resolved using an index, then "y" will receive the number of rows that matched the filter "x". As another example, given "x OR y", if "x" is resolved using an index, then "y" will receive the number of rows that did *not* match the filter "x".totalRowCount- total number of rows to be scanned if no indexes are usedincludeUnknown- mapping for Druid native two state logic system into SQL three-state logic system. If set to true, bitmaps returned by this method should include true bits for any rows where the matching result is 'unknown', such as from the input being null valued. SeeNullHandling.useThreeValueLogic().- Returns:
- bitmap result representing rows matched by this index
-
-