Class GraphExpansion
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.temp.GraphExpansion
-
- All Implemented Interfaces:
KeyExpressionVisitor.Result
public class GraphExpansion extends Object implements KeyExpressionVisitor.Result
Class to abstract behavior when query expansion is applied to query components or key expressions. An object of this class represents a conglomeration for result values, predicates, quantifiers before those elements are unified and eventually find their home in aSelectExpression
. Another way of thinking about this class is to conceptualize logic implemented here as a pre stage to actually creating expressions, as a builder of aSelectExpression
s of sorts. The fundamental difference between a builder in the regular sense and this class is that it also provides getters to all elements and the ability to merge otherGraphExpansion
s in a additive manner. This class also hides some data cleansing process, in particular related to potential duplicity on place holders, which must be corrected (de-duplicated) before the place holders are used in the predicates of e.g. a match candidate.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GraphExpansion.Sealed
A sealed version ofGraphExpansion
that has already reconciled duplicate place holders.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryPredicate
asAndPredicate()
SelectExpression
buildSelectWithBase(Quantifier baseQuantifier)
static GraphExpansion
empty()
List<CorrelationIdentifier>
getPlaceholderAliases()
List<ValueComparisonRangePredicate.Placeholder>
getPlaceholders()
List<QueryPredicate>
getPredicates()
List<Quantifier>
getQuantifiers()
List<Value>
getResultValues()
static GraphExpansion
ofOthers(List<GraphExpansion> graphExpansions)
static GraphExpansion
ofPlaceholder(Value resultValue, ValueComparisonRangePredicate.Placeholder placeholder)
static GraphExpansion
ofPredicate(QueryPredicate predicate)
static GraphExpansion
ofPredicateAndQuantifier(QueryPredicate predicate, Quantifier quantifier)
static GraphExpansion
ofResultValue(Value resultValue)
GraphExpansion.Sealed
seal()
Method to seal a graph expansion in an instance ofGraphExpansion.Sealed
.GraphExpansion
withPredicate(QueryPredicate predicate)
-
-
-
Method Detail
-
getPredicates
@Nonnull public List<QueryPredicate> getPredicates()
-
getQuantifiers
@Nonnull public List<Quantifier> getQuantifiers()
-
getPlaceholders
@Nonnull public List<ValueComparisonRangePredicate.Placeholder> getPlaceholders()
-
getPlaceholderAliases
@Nonnull public List<CorrelationIdentifier> getPlaceholderAliases()
-
asAndPredicate
@Nonnull public QueryPredicate asAndPredicate()
-
withPredicate
@Nonnull public GraphExpansion withPredicate(@Nonnull QueryPredicate predicate)
-
seal
@Nonnull public GraphExpansion.Sealed seal()
Method to seal a graph expansion in an instance ofGraphExpansion.Sealed
. A sealed graph expansion is immutable and can only be used to (repeatedly) build actual expressions. A graph expansion object may contain duplicate information that have been added to it by callers. That is allowed and supported. In fact, in most cases, duplicates among e.g.QueryPredicate
s come from merging individualGraphExpansion
s into more complex ones. This method normalizes all elements beforehand in order to eventually return a sealed version of itself (which is not allowed to contain duplicates).- Returns:
- a sealed graph expansion
-
buildSelectWithBase
@Nonnull public SelectExpression buildSelectWithBase(Quantifier baseQuantifier)
-
empty
@Nonnull public static GraphExpansion empty()
-
ofPredicate
@Nonnull public static GraphExpansion ofPredicate(@Nonnull QueryPredicate predicate)
-
ofResultValue
@Nonnull public static GraphExpansion ofResultValue(@Nonnull Value resultValue)
-
ofPlaceholder
@Nonnull public static GraphExpansion ofPlaceholder(@Nonnull Value resultValue, @Nonnull ValueComparisonRangePredicate.Placeholder placeholder)
-
ofPredicateAndQuantifier
@Nonnull public static GraphExpansion ofPredicateAndQuantifier(@Nonnull QueryPredicate predicate, @Nonnull Quantifier quantifier)
-
ofOthers
@Nonnull public static GraphExpansion ofOthers(@Nonnull List<GraphExpansion> graphExpansions)
-
-