Package org.apache.druid.segment.index
Class DictionaryRangeScanningBitmapIndex
java.lang.Object
org.apache.druid.segment.index.SimpleBitmapColumnIndex
org.apache.druid.segment.index.SimpleImmutableBitmapDelegatingIterableIndex
org.apache.druid.segment.index.DictionaryRangeScanningBitmapIndex
- All Implemented Interfaces:
BitmapColumnIndex
public abstract class DictionaryRangeScanningBitmapIndex
extends SimpleImmutableBitmapDelegatingIterableIndex
Common
BitmapColumnIndex implementation for indexes which need to scan a range of values. Contains logic
to skip computing indexes with computeBitmapResult(BitmapResultFactory, int, int, boolean) if
rangeSize is larger than sizeScale multiplied by the number of selected rows. Numeric range
indexes will typically want to set sizeScale to a double closer to 0.0 than to 1.0 because numeric
comparisons are relatively cheap compared to bitmap operations. Most numerical implementations should use the
value of ColumnConfig.skipValueRangeIndexScale().
Other implementations should adjust sizeScale as appropriate for the expense of the value matcher compared
to the expense of the bitmap operations.
-
Field Summary
Fields inherited from class org.apache.druid.segment.index.SimpleBitmapColumnIndex
CAPABILITIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <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.intReturns an estimated cost for computing the bitmap result.Methods inherited from class org.apache.druid.segment.index.SimpleImmutableBitmapDelegatingIterableIndex
computeBitmapResult, getBitmapIterable, getUnknownsBitmapMethods inherited from class org.apache.druid.segment.index.SimpleBitmapColumnIndex
getIndexCapabilities
-
Constructor Details
-
DictionaryRangeScanningBitmapIndex
public DictionaryRangeScanningBitmapIndex(double sizeScale, int rangeSize)
-
-
Method Details
-
estimatedComputeCost
public int estimatedComputeCost()Description copied from interface:BitmapColumnIndexReturns an estimated cost for computing the bitmap result. Generally this is equivalent to number of bitmap union or intersection operations need to be performed. E.x. null value index bitmap has a cost of 0, non-null value index bitmap union with null bitmap has a cost of 1, range (size of 10) scanning index bitmap union with null bitmap has a cost of 10. -
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.- Returns:
- bitmap result representing rows matched by this index
-