@SubclassesMustOverrideEqualsAndHashCode public interface Filter
| Modifier and Type | Method and Description |
|---|---|
default boolean |
canVectorizeMatcher()
Returns true if this filter can produce a vectorized matcher from its "makeVectorMatcher" method.
|
double |
estimateSelectivity(BitmapIndexSelector indexSelector)
Estimate selectivity of this filter.
|
default ImmutableBitmap |
getBitmapIndex(BitmapIndexSelector selector)
Get a bitmap index, indicating rows that match this filter.
|
<T> T |
getBitmapResult(BitmapIndexSelector selector,
BitmapResultFactory<T> bitmapResultFactory)
Get a (possibly wrapped) bitmap index, indicating rows that match this filter.
|
Set<String> |
getRequiredColumns()
Set of columns used by a filter.
|
ValueMatcher |
makeMatcher(ColumnSelectorFactory factory)
Get a ValueMatcher that applies this filter to row values.
|
default VectorValueMatcher |
makeVectorMatcher(VectorColumnSelectorFactory factory)
Get a VectorValueMatcher that applies this filter to row vectors.
|
default 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. |
default 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.
|
default ImmutableBitmap getBitmapIndex(BitmapIndexSelector selector)
supportsBitmapIndex(BitmapIndexSelector) returns true. Behavior in the case that
supportsBitmapIndex(BitmapIndexSelector) returns false is undefined.
This method is OK to be called, but generally should not be overridden, override getBitmapResult(org.apache.druid.query.filter.BitmapIndexSelector, org.apache.druid.query.BitmapResultFactory<T>) instead.selector - Object used to retrieve bitmap indexesestimateSelectivity(BitmapIndexSelector)<T> T getBitmapResult(BitmapIndexSelector selector, BitmapResultFactory<T> bitmapResultFactory)
supportsBitmapIndex(BitmapIndexSelector) returns true. Behavior in the case that
supportsBitmapIndex(BitmapIndexSelector) returns false is undefined.selector - Object used to retrieve bitmap indexesestimateSelectivity(BitmapIndexSelector)double estimateSelectivity(BitmapIndexSelector indexSelector)
AutoStrategy.
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.indexSelector - Object used to retrieve bitmap indexesgetBitmapIndex(BitmapIndexSelector)ValueMatcher makeMatcher(ColumnSelectorFactory factory)
factory - Object used to create ValueMatchersdefault VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory)
factory - Object used to create ValueMatchersboolean supportsBitmapIndex(BitmapIndexSelector selector)
BitmapIndexSelector.
Returning a value of true here guarantees that getBitmapIndex(BitmapIndexSelector) will return a non-null
BitmapIndexSelector, and also that all columns specified in getRequiredColumns() have a bitmap
index retrievable via BitmapIndexSelector.getBitmapIndex(String).selector - Object used to retrieve bitmap indexesboolean shouldUseBitmapIndex(BitmapIndexSelector selector)
BitmapIndexSelector. This method differs from supportsBitmapIndex(BitmapIndexSelector) in that
the former only indicates if a bitmap index is available and getBitmapIndex(BitmapIndexSelector) may be
used.
If shouldUseFilter(selector) returns true, 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 getBitmapIndex(BitmapIndexSelector)
will return a non-null BitmapIndexSelector, and also that all columns specified in
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).selector - Object used to retrieve bitmap indexes and provide information about the columnboolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector)
columnSelector - Object to check the dimension has multi values.indexSelector - Object used to retrieve bitmap indexesdefault boolean canVectorizeMatcher()
Set<String> getRequiredColumns()
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)default boolean supportsRequiredColumnRewrite()
default Filter rewriteRequiredColumns(Map<String,String> columnRewrites)
columnRewrites - Column rewrite mapCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.