public class SelectorFilter extends Object implements Filter
dimension has the value. The value can be null.
In SQL-compatible null handling mode, this filter is equivalent to dimension = value
or dimension IS NULL when the value is null.
In default null handling mode, this filter is equivalent to dimension = value or
dimension = '' when the value is null.| Constructor and Description |
|---|
SelectorFilter(String dimension,
String value) |
SelectorFilter(String dimension,
String value,
FilterTuning filterTuning) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canVectorizeMatcher()
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.
|
String |
getDimension() |
Set<String> |
getRequiredColumns()
Set of columns used by a filter.
|
String |
getValue() |
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.
|
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.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetBitmapIndexpublic SelectorFilter(String dimension, String value, @Nullable FilterTuning filterTuning)
public <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 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 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 indexespublic 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 boolean canVectorizeMatcher()
FiltercanVectorizeMatcher in interface Filterpublic 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 Filterpublic boolean supportsRequiredColumnRewrite()
FiltersupportsRequiredColumnRewrite in interface Filterpublic Filter rewriteRequiredColumns(Map<String,String> columnRewrites)
FilterrewriteRequiredColumns in interface FiltercolumnRewrites - Column rewrite mappublic String getDimension()
public String getValue()
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.