Package org.apache.druid.segment.filter
Class Filters
java.lang.Object
org.apache.druid.segment.filter.Filters
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilterCreate a filter representing an AND relationship across a list of filters.static booleancheckFilterTuningUseIndex(String columnName, ColumnIndexSelector indexSelector, FilterTuning filterTuning) static ImmutableBitmapcomputeDefaultBitmapResults(Filter filter, ColumnIndexSelector selector) static Filterconjunction(Filter... filters) static FilterconvertToCNFFromQueryContext(Query query, Filter filter) static intcountNumberOfFilters(Filter filter) static booleanfilterMatchesNull(Filter filter) static BitmapColumnIndexmakeMissingColumnNullIndex(DruidPredicateMatch match, ColumnIndexSelector selector) static BitmapColumnIndexmakePredicateIndex(String column, ColumnIndexSelector selector, DruidPredicateFactory predicateFactory) static ValueMatchermakeValueMatcher(ColumnSelectorFactory columnSelectorFactory, String columnName, DruidPredicateFactory predicateFactory) Create a ValueMatcher that applies a predicate to row values.Likeand(java.util.List<org.apache.druid.query.filter.Filter>), but returns an empty Optional instead of throwing an exception if "filters" is empty or only contains nulls.Likeor(java.util.List<org.apache.druid.query.filter.Filter>), but returns an empty Optional instead of throwing an exception if "filters" is empty or only contains nulls.static FilterCreate a filter representing an OR relationship across a list of filters.static Filterstatic FiltertoNormalizedOrClauses(Filter filter)
-
Constructor Details
-
Filters
public Filters()
-
-
Method Details
-
toFilter
Convert aDimFilterto an optimizedFilterfor use at the top level of a query. Must not be used byDimFilterto convert their children, because the three-valued logic parameter "includeUnknown" will not be correctly propagated. ForDimFilterthat convert their children, useDimFilter.toOptimizedFilter(boolean)instead.- Parameters:
dimFilter- dimFilter- Returns:
- converted filter, or null if input was null
-
makeValueMatcher
public static ValueMatcher makeValueMatcher(ColumnSelectorFactory columnSelectorFactory, String columnName, DruidPredicateFactory predicateFactory) Create a ValueMatcher that applies a predicate to row values.The caller provides a predicate factory that can create a predicate for each value type supported by Druid. See
DruidPredicateFactoryfor 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.
- Parameters:
columnSelectorFactory- Selector for columns.columnName- The column to filter.predicateFactory- Predicate factory- Returns:
- An object that applies a predicate to row values
-
makePredicateIndex
@Nullable public static BitmapColumnIndex makePredicateIndex(String column, ColumnIndexSelector selector, DruidPredicateFactory predicateFactory) -
makeMissingColumnNullIndex
public static BitmapColumnIndex makeMissingColumnNullIndex(DruidPredicateMatch match, ColumnIndexSelector selector) -
computeDefaultBitmapResults
public static ImmutableBitmap computeDefaultBitmapResults(Filter filter, ColumnIndexSelector selector) -
convertToCNFFromQueryContext
-
toCnf
- Throws:
CNFFilterExplosionException
-
checkFilterTuningUseIndex
public static boolean checkFilterTuningUseIndex(String columnName, ColumnIndexSelector indexSelector, @Nullable FilterTuning filterTuning) -
and
Create a filter representing an AND relationship across a list of filters. Deduplicates filters, flattens stacks, and removes null filters and literal "false" filters.- Parameters:
filters- List of filters- Returns:
- If "filters" has more than one filter remaining after processing, returns
AndFilter. If "filters" has a single element remaining after processing, return that filter alone. - Throws:
IllegalArgumentException- if "filters" is empty or only contains nulls
-
maybeAnd
Likeand(java.util.List<org.apache.druid.query.filter.Filter>), but returns an empty Optional instead of throwing an exception if "filters" is empty or only contains nulls. -
or
Create a filter representing an OR relationship across a list of filters. Deduplicates filters, flattens stacks, and removes null filters and literal "false" filters.- Parameters:
filters- List of filters- Returns:
- If "filters" has more than one filter remaining after processing, returns
OrFilter. If "filters" has a single element remaining after processing, return that filter alone. - Throws:
IllegalArgumentException- if "filters" is empty
-
maybeOr
Likeor(java.util.List<org.apache.druid.query.filter.Filter>), but returns an empty Optional instead of throwing an exception if "filters" is empty or only contains nulls. -
toNormalizedOrClauses
- Parameters:
filter- the filter.- Returns:
- The normalized or clauses for the provided filter.
- Throws:
CNFFilterExplosionException
-
filterMatchesNull
-
countNumberOfFilters
-
conjunction
-