Class CollectComparisons<BaseType,ComparisonType extends BaseType,CollectedType extends BaseType,CollectionKey,CollectionElementType,CollectionType extends Collection<CollectionElementType>>
java.lang.Object
org.apache.druid.sql.calcite.filtration.CollectComparisons<BaseType,ComparisonType,CollectedType,CollectionKey,CollectionElementType,CollectionType>
public abstract class CollectComparisons<BaseType,ComparisonType extends BaseType,CollectedType extends BaseType,CollectionKey,CollectionElementType,CollectionType extends Collection<CollectionElementType>>
extends Object
Utility class for collecting point comparisons that are children to an OR, such as equalities. Each set of
comparisons with the same
CollectComparisons can potentially become a single CollectComparisons.
For example: x = 'a', x = 'b' can become x IN ('a', 'b').-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncollect()Perform collection logic on the exprs provided to the constructor.protected abstract Pair<ComparisonType,List<BaseType>> Given an expression, returns a collectible comparison (if the provided expression is collectible), or returns a pair of collectible comparison and other expressions (if the provided expression is an AND of a collectible comparison and those other expressions).protected abstract CollectionKeygetCollectionKey(ComparisonType comparison) Given a comparison, returns its collection key, which will be used to group it together with like comparisons.protected abstract Set<CollectionElementType>getMatchValues(ComparisonType comparison) Given a comparison, returns the strings that it matches.protected abstract BaseTypeGiven a list of expressions, returns an AND expression with those exprs as children.protected abstract CollectedTypemakeCollectedComparison(CollectionKey key, CollectionType values) Given a set of strings fromgetMatchValues(Object)from various comparisons, returns a single collected comparison that matches all those strings.protected abstract CollectionType
-
Constructor Details
-
CollectComparisons
-
-
Method Details
-
collect
Perform collection logic on the exprs provided to the constructor. -
getCollectibleComparison
@Nullable protected abstract Pair<ComparisonType,List<BaseType>> getCollectibleComparison(BaseType expr) Given an expression, returns a collectible comparison (if the provided expression is collectible), or returns a pair of collectible comparison and other expressions (if the provided expression is an AND of a collectible comparison and those other expressions). -
makeCollection
-
getCollectionKey
Given a comparison, returns its collection key, which will be used to group it together with like comparisons. This method will be called on objects returned bygetCollectibleComparison(Object). If this method returns null, the filter is considered non-collectible. -
getMatchValues
Given a comparison, returns the strings that it matches. -
makeCollectedComparison
@Nullable protected abstract CollectedType makeCollectedComparison(CollectionKey key, CollectionType values) Given a set of strings fromgetMatchValues(Object)from various comparisons, returns a single collected comparison that matches all those strings. -
makeAnd
Given a list of expressions, returns an AND expression with those exprs as children. Only called ifgetCollectibleComparison(Object)returns nonempty right-hand-sides.
-