Interface ValueSetIndexes
-
- All Known Implementing Classes:
IndexedUtf8ValueIndexes
public interface ValueSetIndexesConstruct aBitmapColumnIndexfor a set of values which might be present in the column.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classValueSetIndexes.BaseValueSetIndexesFromIterable
-
Field Summary
-
Method Summary
-
-
-
Field Detail
-
SORTED_SCAN_RATIO_THRESHOLD
static final double SORTED_SCAN_RATIO_THRESHOLD
threshold 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>, 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>, 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:
- Constant Field Values
-
SIZE_WORTH_CHECKING_MIN
static final int SIZE_WORTH_CHECKING_MIN
minimum 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>, 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>, 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:
- Constant Field Values
-
-
Method Detail
-
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, 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 anIterablethat is sorted the same as the columnsIndexedvalue 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.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>, 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>, 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, 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 anIterablethat is sorted the same as the columnsIndexedvalue dictionary. This algorithm iterates the values to match and does a binary search for matching values usingIndexed.indexOf(Object)to build aIterableshort-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>, 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>, 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, 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 anIterablethat is NOT sorted the same as the columnsIndexedvalue dictionary. This algorithm iterates the values to match and does a binary search for matching values usingIndexed.indexOf(Object)to build aIterableuntil 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>, 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>, 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.
-
-