public class InDimFilter extends AbstractOptimizableDimFilter implements Filter
| Modifier and Type | Class and Description |
|---|---|
static class |
InDimFilter.InFilterDruidPredicateFactory |
DimFilter.DimFilterToStringBuilder| Constructor and Description |
|---|
InDimFilter(String dimension,
Collection<String> values,
ExtractionFn extractionFn)
This constructor should be called only in unit tests since accepting a Collection makes copying more likely.
|
InDimFilter(String dimension,
Set<String> values)
Creates a new filter without an extraction function or any special filter tuning.
|
InDimFilter(String dimension,
Set<String> values,
ExtractionFn extractionFn,
FilterTuning filterTuning)
Creates a new filter.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canVectorizeMatcher(ColumnInspector inspector)
Returns true if this filter can produce a vectorized matcher from its "makeVectorMatcher" method.
|
boolean |
equals(Object o) |
double |
estimateSelectivity(BitmapIndexSelector indexSelector)
Estimate selectivity of this filter.
|
<T> T |
getBitmapResult(BitmapIndexSelector selector,
BitmapResultFactory<T> bitmapResultFactory)
Get a (possibly wrapped) bitmap index, indicating rows that match this filter.
|
byte[] |
getCacheKey() |
String |
getDimension() |
com.google.common.collect.RangeSet<String> |
getDimensionRangeSet(String dimension)
Returns a RangeSet that represents the possible range of the input dimension for this DimFilter.This is
applicable to filters that use dimensions such as select, in, bound, and logical filters such as and, or, not.
|
ExtractionFn |
getExtractionFn() |
FilterTuning |
getFilterTuning() |
Set<String> |
getRequiredColumns()
Set of columns used by a filter.
|
Set<String> |
getValues() |
int |
hashCode() |
ValueMatcher |
makeMatcher(ColumnSelectorFactory factory)
Get a ValueMatcher that applies this filter to row values.
|
VectorValueMatcher |
makeVectorMatcher(VectorColumnSelectorFactory factory)
Get a VectorValueMatcher that applies this filter to row vectors.
|
DimFilter |
optimize() |
Filter |
rewriteRequiredColumns(Map<String,String> columnRewrites)
Return a copy of this filter that is identical to the this filter except that it operates on different columns,
based on a renaming map where the key is the column to be renamed in the filter, and the value is the new
column name.
|
boolean |
shouldUseBitmapIndex(BitmapIndexSelector selector)
Determine if a filter *should* use a bitmap index based on information collected from the supplied
BitmapIndexSelector. |
boolean |
supportsBitmapIndex(BitmapIndexSelector selector)
Indicates whether this filter can return a bitmap index for filtering, based on the information provided by the
input
BitmapIndexSelector. |
boolean |
supportsRequiredColumnRewrite()
Returns true is this filter is able to return a copy of this filter that is identical to this filter except that it
operates on different columns, based on a renaming map.
|
boolean |
supportsSelectivityEstimation(ColumnSelector columnSelector,
BitmapIndexSelector indexSelector)
Indicates whether this filter supports selectivity estimation.
|
Filter |
toFilter()
Returns a Filter that implements this DimFilter.
|
String |
toString() |
toOptimizedFilterclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetBitmapIndexpublic InDimFilter(String dimension, Set<String> values, @Nullable ExtractionFn extractionFn, @Nullable FilterTuning filterTuning)
dimension - column to searchvalues - set of values to match. This collection may be reused to avoid copying a big collection.
Therefore, callers should not modify the collection after it is passed to this
constructor.extractionFn - extraction function to apply to the column before checking against "values"filterTuning - optional tuningpublic InDimFilter(String dimension, Set<String> values)
dimension - column to searchvalues - set of values to match. This collection may be reused to avoid copying a big collection.
Therefore, callers should not modify the collection after it is passed to this
constructor.public InDimFilter(String dimension, Collection<String> values, @Nullable ExtractionFn extractionFn)
public String getDimension()
@Nullable public ExtractionFn getExtractionFn()
@Nullable public FilterTuning getFilterTuning()
public byte[] getCacheKey()
getCacheKey in interface Cacheablepublic DimFilter optimize()
public Filter toFilter()
DimFilter@Nullable public com.google.common.collect.RangeSet<String> getDimensionRangeSet(String dimension)
DimFiltergetDimensionRangeSet in interface DimFilterdimension - name of the dimension to get range forpublic Set<String> getRequiredColumns()
FilterFilter.supportsBitmapIndex(org.apache.druid.query.filter.BitmapIndexSelector) returns true, all columns returned by this method
can be expected to have a bitmap index retrievable via BitmapIndexSelector.getBitmapIndex(String)getRequiredColumns in interface DimFiltergetRequiredColumns in interface Filterpublic <T> T getBitmapResult(BitmapIndexSelector selector, BitmapResultFactory<T> bitmapResultFactory)
FilterFilter.supportsBitmapIndex(BitmapIndexSelector) returns true. Behavior in the case that
Filter.supportsBitmapIndex(BitmapIndexSelector) returns false is undefined.getBitmapResult in interface Filterselector - Object used to retrieve bitmap indexesFilter.estimateSelectivity(BitmapIndexSelector)public double estimateSelectivity(BitmapIndexSelector indexSelector)
FilterAutoStrategy.
To avoid significant performance degradation for calculating the exact cost,
implementation of this method targets to achieve rapid selectivity estimation
with reasonable sacrifice of the accuracy.
As a result, the estimated selectivity might be different from the exact value.estimateSelectivity in interface FilterindexSelector - Object used to retrieve bitmap indexesFilter.getBitmapIndex(BitmapIndexSelector)public ValueMatcher makeMatcher(ColumnSelectorFactory factory)
FiltermakeMatcher in interface Filterfactory - Object used to create ValueMatcherspublic VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory)
FiltermakeVectorMatcher in interface Filterfactory - Object used to create ValueMatcherspublic boolean canVectorizeMatcher(ColumnInspector inspector)
FiltercanVectorizeMatcher in interface Filterinspector - Supplies type information for the selectors this filter will match againstpublic boolean supportsRequiredColumnRewrite()
FiltersupportsRequiredColumnRewrite in interface Filterpublic Filter rewriteRequiredColumns(Map<String,String> columnRewrites)
FilterrewriteRequiredColumns in interface FiltercolumnRewrites - Column rewrite mappublic boolean supportsBitmapIndex(BitmapIndexSelector selector)
FilterBitmapIndexSelector.
Returning a value of true here guarantees that Filter.getBitmapIndex(BitmapIndexSelector) will return a non-null
BitmapIndexSelector, and also that all columns specified in Filter.getRequiredColumns() have a bitmap
index retrievable via BitmapIndexSelector.getBitmapIndex(String).supportsBitmapIndex in interface Filterselector - Object used to retrieve bitmap indexespublic boolean shouldUseBitmapIndex(BitmapIndexSelector selector)
FilterBitmapIndexSelector. This method differs from Filter.supportsBitmapIndex(BitmapIndexSelector) in that
the former only indicates if a bitmap index is available and Filter.getBitmapIndex(BitmapIndexSelector) may be
used.
If shouldUseFilter(selector) returns true, Filter.supportsBitmapIndex(org.apache.druid.query.filter.BitmapIndexSelector) must also return true when called with the
same selector object. Returning a value of true here guarantees that Filter.getBitmapIndex(BitmapIndexSelector)
will return a non-null BitmapIndexSelector, and also that all columns specified in
Filter.getRequiredColumns() have a bitmap index retrievable via
BitmapIndexSelector.getBitmapIndex(String).
Implementations of this methods typically consider a FilterTuning to make decisions about when to
use an available index. A "standard" implementation of this is available to all Filter implementations in
Filters.shouldUseBitmapIndex(Filter, BitmapIndexSelector, FilterTuning).shouldUseBitmapIndex in interface Filterselector - Object used to retrieve bitmap indexes and provide information about the columnpublic boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector)
FiltersupportsSelectivityEstimation in interface FiltercolumnSelector - Object to check the dimension has multi values.indexSelector - Object used to retrieve bitmap indexesCopyright © 2011–2021 The Apache Software Foundation. All rights reserved.