Class ViewExpressionComparisons
- java.lang.Object
-
- com.apple.foundationdb.record.query.plan.temp.view.ViewExpressionComparisons
-
public class ViewExpressionComparisons extends Object
A data structure that represents aViewExpression
with aComparisonRange
on some of theElement
s in its sort order.A
ViewExpressionComparisons
is an analogue of aScanComparisons
that maintains information about which elements in the sort order of aViewExpression
correspond to each comparison. It maintains a list ofComparisonRange
s for each of the elements. ThematchWith(ElementPredicate)
method can then take aElementPredicate
and try to add it to the existing comparisons.The
ViewExpressionComparisons
encapsulates the core logic of marking parts of a complex key expression as satisfied by various types ofComparisons.Comparison
s and attempting to match more comparisons to the remaining parts of the expression. This includes the "virtual"Comparisons.SortComparison
which is used only to represent requested sort orders for index planning.While this sounds a lot like a whole query planner, the scope of a
ViewExpressionComparisons
is intentionally very limited. In particular, it supports matching with anElementPredicate
rather than a more generalQueryPredicate
As a result, the logic for handling Boolean operations and other complexities does not belong inViewExpressionComparisons
.
-
-
Constructor Summary
Constructors Constructor Description ViewExpressionComparisons(ViewExpression viewExpression)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getUnmatchedFieldCount()
boolean
hasComparison(Source source)
boolean
hasOrderBySourceWithoutComparison()
Optional<ViewExpressionComparisons>
matchWith(ElementPredicate component)
Optional<ViewExpressionComparisons>
matchWithSort(List<Element> sortOrder)
ScanComparisons
toScanComparisons()
Convert these comparisons toScanComparisons
for query execution.ViewExpressionComparisons
withSourcesMappedInto(Source originalSource, Source duplicateSource)
Replace the given duplicate source with the given original source everywhere that it occurs in these view expression comparisons.
-
-
-
Constructor Detail
-
ViewExpressionComparisons
public ViewExpressionComparisons(@Nonnull ViewExpression viewExpression)
-
-
Method Detail
-
matchWith
@Nonnull public Optional<ViewExpressionComparisons> matchWith(@Nonnull ElementPredicate component)
-
matchWithSort
@Nonnull public Optional<ViewExpressionComparisons> matchWithSort(@Nonnull List<Element> sortOrder)
-
getUnmatchedFieldCount
public int getUnmatchedFieldCount()
-
hasOrderBySourceWithoutComparison
public boolean hasOrderBySourceWithoutComparison()
-
withSourcesMappedInto
@Nonnull public ViewExpressionComparisons withSourcesMappedInto(@Nonnull Source originalSource, @Nonnull Source duplicateSource)
Replace the given duplicate source with the given original source everywhere that it occurs in these view expression comparisons.- Parameters:
originalSource
- a source to replace all occurrences of the duplicate source withduplicateSource
- a source to replace with the original source- Returns:
- a copy of these comparisons with all occurrences of the duplicate source replaced with the original source
-
toScanComparisons
@Nonnull public ScanComparisons toScanComparisons()
Convert these comparisons toScanComparisons
for query execution.- Returns:
- these comparisons as
ScanComparisons
-
-