Interface ValueSetIndexes
- All Known Implementing Classes:
IndexedUtf8ValueIndexes
BitmapColumnIndex for a set of values which might be present in the column.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intminimum sorted match value iterator size to trim the initial values from the iterator to seek to the start of the value dictionary when usingbuildBitmapColumnIndexFromSortedIteratorScan(org.apache.druid.collections.bitmap.BitmapFactory, java.util.Comparator<T>, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>)orbuildBitmapColumnIndexFromSortedIteratorBinarySearch(org.apache.druid.collections.bitmap.BitmapFactory, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>).static final doublethreshold of sorted match value iterator size compared to dictionary size to usebuildBitmapColumnIndexFromSortedIteratorScan(org.apache.druid.collections.bitmap.BitmapFactory, java.util.Comparator<T>, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>)instead ofbuildBitmapColumnIndexFromSortedIteratorBinarySearch(org.apache.druid.collections.bitmap.BitmapFactory, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>). -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> BitmapColumnIndexbuildBitmapColumnIndexFromIteratorBinarySearch(BitmapFactory bitmapFactory, Iterable<T> values, int size, Indexed<T> dictionary, Indexed<ImmutableBitmap> bitmaps, com.google.common.base.Supplier<ImmutableBitmap> getUnknownsIndex) Helper method for implementingforSortedValues(java.util.List<?>, org.apache.druid.segment.column.TypeSignature<org.apache.druid.segment.column.ValueType>)for a value set that is NOT sorted the same as the column dictionary.static <T> BitmapColumnIndexbuildBitmapColumnIndexFromSortedIteratorBinarySearch(BitmapFactory bitmapFactory, Iterable<T> values, int size, Indexed<T> dictionary, Indexed<ImmutableBitmap> bitmaps, com.google.common.base.Supplier<ImmutableBitmap> getUnknownsIndex) Helper method for implementingforSortedValues(java.util.List<?>, org.apache.druid.segment.column.TypeSignature<org.apache.druid.segment.column.ValueType>)for a value set that is sorted the same as the column dictionary.static <T> BitmapColumnIndexbuildBitmapColumnIndexFromSortedIteratorScan(BitmapFactory bitmapFactory, Comparator<T> comparator, Iterable<T> values, int size, Indexed<T> dictionary, Indexed<ImmutableBitmap> bitmaps, com.google.common.base.Supplier<ImmutableBitmap> unknownsBitmap) Helper method for implementingforSortedValues(java.util.List<?>, org.apache.druid.segment.column.TypeSignature<org.apache.druid.segment.column.ValueType>)for a value set that is sorted the same as the column dictionary.forSortedValues(List<?> sortedValues, TypeSignature<ValueType> matchValueType) Get the wrappedImmutableBitmapcorresponding to the specified set of values (if they are contained in the underlying column).
-
Field Details
-
SORTED_SCAN_RATIO_THRESHOLD
static final double SORTED_SCAN_RATIO_THRESHOLDthreshold of sorted match value iterator size compared to dictionary size to usebuildBitmapColumnIndexFromSortedIteratorScan(org.apache.druid.collections.bitmap.BitmapFactory, java.util.Comparator<T>, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>)instead ofbuildBitmapColumnIndexFromSortedIteratorBinarySearch(org.apache.druid.collections.bitmap.BitmapFactory, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>).- See Also:
-
SIZE_WORTH_CHECKING_MIN
static final int SIZE_WORTH_CHECKING_MINminimum sorted match value iterator size to trim the initial values from the iterator to seek to the start of the value dictionary when usingbuildBitmapColumnIndexFromSortedIteratorScan(org.apache.druid.collections.bitmap.BitmapFactory, java.util.Comparator<T>, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>)orbuildBitmapColumnIndexFromSortedIteratorBinarySearch(org.apache.druid.collections.bitmap.BitmapFactory, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>).- See Also:
-
-
Method Details
-
forSortedValues
@Nullable BitmapColumnIndex forSortedValues(@Nonnull List<?> sortedValues, TypeSignature<ValueType> matchValueType) Get the wrappedImmutableBitmapcorresponding to the specified set of values (if they are contained in the underlying column). The set must be sorted using the comparator of the supplied matchValueType.- Parameters:
sortedValues- values to match, sorted in matchValueType ordermatchValueType- type of the value to match, used to assist conversion from the match value type to the column value type- Returns:
ImmutableBitmapcorresponding to the rows which match the values, or null if an index connot be computed for the supplied value type
-
buildBitmapColumnIndexFromSortedIteratorScan
static <T> BitmapColumnIndex buildBitmapColumnIndexFromSortedIteratorScan(BitmapFactory bitmapFactory, Comparator<T> comparator, Iterable<T> values, int size, Indexed<T> dictionary, Indexed<ImmutableBitmap> bitmaps, com.google.common.base.Supplier<ImmutableBitmap> unknownsBitmap) Helper method for implementingforSortedValues(java.util.List<?>, org.apache.druid.segment.column.TypeSignature<org.apache.druid.segment.column.ValueType>)for a value set that is sorted the same as the column dictionary.Builds a
BitmapColumnIndexfrom anIterable<T>that is sorted the same as the columnsIndexed<T>value dictionary. Uses a strategy that does zipping similar to the merge step of a sort-merge, where we step forward on both the iterator and the dictionary to find matches to build aIterable<ImmutableBitmap>.If sorted match value iterator size is greater than (dictionary size *
SORTED_SCAN_RATIO_THRESHOLD), consider using this method instead ofbuildBitmapColumnIndexFromSortedIteratorBinarySearch(org.apache.druid.collections.bitmap.BitmapFactory, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>).If the values in the iterator are NOT sorted the same as the dictionary, do NOT use this method, use
buildBitmapColumnIndexFromIteratorBinarySearch(org.apache.druid.collections.bitmap.BitmapFactory, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>)instead. -
buildBitmapColumnIndexFromSortedIteratorBinarySearch
static <T> BitmapColumnIndex buildBitmapColumnIndexFromSortedIteratorBinarySearch(BitmapFactory bitmapFactory, Iterable<T> values, int size, Indexed<T> dictionary, Indexed<ImmutableBitmap> bitmaps, com.google.common.base.Supplier<ImmutableBitmap> getUnknownsIndex) Helper method for implementingforSortedValues(java.util.List<?>, org.apache.druid.segment.column.TypeSignature<org.apache.druid.segment.column.ValueType>)for a value set that is sorted the same as the column dictionary.Builds a
BitmapColumnIndexfrom anIterable<T>that is sorted the same as the columnsIndexed<T>value dictionary. This algorithm iterates the values to match and does a binary search for matching values usingIndexed.indexOf(Object)to build aIterable<ImmutableBitmap>short-circuiting the iteration if we reach the end of theIndexedbefore the values to match are exhausted.If sorted match value iterator size is less than (dictionary size *
SORTED_SCAN_RATIO_THRESHOLD), consider using this method instead ofbuildBitmapColumnIndexFromSortedIteratorScan(org.apache.druid.collections.bitmap.BitmapFactory, java.util.Comparator<T>, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>).If the values in the iterator are not sorted the same as the dictionary, do not use this method, use
buildBitmapColumnIndexFromIteratorBinarySearch(org.apache.druid.collections.bitmap.BitmapFactory, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>)instead. -
buildBitmapColumnIndexFromIteratorBinarySearch
static <T> BitmapColumnIndex buildBitmapColumnIndexFromIteratorBinarySearch(BitmapFactory bitmapFactory, Iterable<T> values, int size, Indexed<T> dictionary, Indexed<ImmutableBitmap> bitmaps, com.google.common.base.Supplier<ImmutableBitmap> getUnknownsIndex) Helper method for implementingforSortedValues(java.util.List<?>, org.apache.druid.segment.column.TypeSignature<org.apache.druid.segment.column.ValueType>)for a value set that is NOT sorted the same as the column dictionary.Builds a
BitmapColumnIndexfrom anIterable<T>that is NOT sorted the same as the columnsIndexed<T>value dictionary. This algorithm iterates the values to match and does a binary search for matching values usingIndexed.indexOf(Object)to build aIterable<ImmutableBitmap>until the match values iterator is exhausted.If values of the iterator are sorted the same as the dictionary, use
buildBitmapColumnIndexFromSortedIteratorScan(org.apache.druid.collections.bitmap.BitmapFactory, java.util.Comparator<T>, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>)orbuildBitmapColumnIndexFromSortedIteratorBinarySearch(org.apache.druid.collections.bitmap.BitmapFactory, java.lang.Iterable<T>, int, org.apache.druid.segment.data.Indexed<T>, org.apache.druid.segment.data.Indexed<org.apache.druid.collections.bitmap.ImmutableBitmap>, com.google.common.base.Supplier<org.apache.druid.collections.bitmap.ImmutableBitmap>)instead.
-