public class Filters extends Object
Modifier and Type | Field and Description |
---|---|
static List<ValueType> |
FILTERABLE_TYPES |
Constructor and Description |
---|
Filters() |
Modifier and Type | Method and Description |
---|---|
static ImmutableBitmap |
allFalse(BitmapIndexSelector selector) |
static ImmutableBitmap |
allTrue(BitmapIndexSelector selector) |
static Filter |
convertToCNF(Filter current) |
static Filter |
convertToCNFFromQueryContext(Query query,
Filter filter) |
static double |
estimateSelectivity(BitmapIndex bitmapIndex,
it.unimi.dsi.fastutil.ints.IntList bitmaps,
long totalNumRows)
Return an estimated selectivity for bitmaps for the dimension values given by dimValueIndexes.
|
static double |
estimateSelectivity(Iterator<ImmutableBitmap> bitmaps,
long totalNumRows)
Return an estimated selectivity for bitmaps given by an iterator.
|
static double |
estimateSelectivity(String dimension,
BitmapIndexSelector indexSelector,
com.google.common.base.Predicate<String> predicate)
Return an estimated selectivity for bitmaps of all values matching the given predicate.
|
static ValueMatcher |
getLongPredicateMatcher(LongColumnSelector longSelector,
DruidLongPredicate predicate) |
static ValueMatcher |
getLongValueMatcher(LongColumnSelector longSelector,
String value) |
static ValueMatcher |
makeValueMatcher(ColumnSelectorFactory columnSelectorFactory,
String columnName,
DruidPredicateFactory predicateFactory)
Create a ValueMatcher that applies a predicate to row values.
|
static ValueMatcher |
makeValueMatcher(ColumnSelectorFactory columnSelectorFactory,
String columnName,
String value)
Create a ValueMatcher that compares row values to the provided string.
|
static ImmutableBitmap |
matchPredicate(String dimension,
BitmapIndexSelector selector,
com.google.common.base.Predicate<String> predicate)
Return the union of bitmaps for all values matching a particular predicate.
|
static Iterable<ImmutableBitmap> |
matchPredicateNoUnion(String dimension,
BitmapIndexSelector selector,
com.google.common.base.Predicate<String> predicate)
Return an iterable of bitmaps for all values matching a particular predicate.
|
static Filter |
toFilter(DimFilter dimFilter)
Convert a DimFilter to a Filter.
|
static List<Filter> |
toFilters(List<DimFilter> dimFilters)
Convert a list of DimFilters to a list of Filters.
|
public static List<Filter> toFilters(List<DimFilter> dimFilters)
dimFilters
- list of DimFilters, should all be non-nullpublic static Filter toFilter(DimFilter dimFilter)
dimFilter
- dimFilterpublic static ValueMatcher makeValueMatcher(ColumnSelectorFactory columnSelectorFactory, String columnName, String value)
An implementation of this method should be able to handle dimensions of various types.
columnSelectorFactory
- Selector for columns.columnName
- The column to filter.value
- The value to match against, represented as a String.public static ValueMatcher makeValueMatcher(ColumnSelectorFactory columnSelectorFactory, String columnName, DruidPredicateFactory predicateFactory)
The caller provides a predicate factory that can create a predicate for each value type supported by Druid.
See DruidPredicateFactory
for more information.
When creating the ValueMatcher, the ValueMatcherFactory implementation should decide what type of predicate to create from the predicate factory based on the ValueType of the specified dimension.
columnSelectorFactory
- Selector for columns.columnName
- The column to filter.predicateFactory
- Predicate factorypublic static ImmutableBitmap allFalse(BitmapIndexSelector selector)
public static ImmutableBitmap allTrue(BitmapIndexSelector selector)
public static ImmutableBitmap matchPredicate(String dimension, BitmapIndexSelector selector, com.google.common.base.Predicate<String> predicate)
dimension
- dimension to look atselector
- bitmap selectorpredicate
- predicate to useestimateSelectivity(String, BitmapIndexSelector, Predicate)
public static Iterable<ImmutableBitmap> matchPredicateNoUnion(String dimension, BitmapIndexSelector selector, com.google.common.base.Predicate<String> predicate)
matchPredicate(String, BitmapIndexSelector, Predicate)
would have
returned.dimension
- dimension to look atselector
- bitmap selectorpredicate
- predicate to usepublic static double estimateSelectivity(String dimension, BitmapIndexSelector indexSelector, com.google.common.base.Predicate<String> predicate)
dimension
- dimension to look atindexSelector
- bitmap selectorpredicate
- predicate to usematchPredicate(String, BitmapIndexSelector, Predicate)
public static double estimateSelectivity(BitmapIndex bitmapIndex, it.unimi.dsi.fastutil.ints.IntList bitmaps, long totalNumRows)
bitmapIndex
- bitmap indexbitmaps
- bitmaps to extract, by indextotalNumRows
- number of rows in the column associated with this bitmap indexpublic static double estimateSelectivity(Iterator<ImmutableBitmap> bitmaps, long totalNumRows)
bitmaps
- iterator of bitmapstotalNumRows
- number of rows in the column associated with this bitmap indexpublic static ValueMatcher getLongValueMatcher(LongColumnSelector longSelector, String value)
public static ValueMatcher getLongPredicateMatcher(LongColumnSelector longSelector, DruidLongPredicate predicate)
public static Filter convertToCNFFromQueryContext(Query query, Filter filter)
Copyright © 2011–2017. All rights reserved.