use of com.apple.foundationdb.record.query.plan.temp.RelationalExpression in project fdb-record-layer by FoundationDB.
the class MatchLeafRule method onMatch.
@Override
public void onMatch(@Nonnull PlannerRuleCall call) {
final PlanContext context = call.getContext();
final RelationalExpression expression = call.get(root);
// iterate through all candidates known to the context
for (final MatchCandidate matchCandidate : context.getMatchCandidates()) {
final ExpressionRefTraversal traversal = matchCandidate.getTraversal();
final Set<ExpressionRef<? extends RelationalExpression>> leafRefs = traversal.getLeafReferences();
// iterate through all leaf references in all
for (final ExpressionRef<? extends RelationalExpression> leafRef : leafRefs) {
for (final RelationalExpression leafMember : leafRef.getMembers()) {
// expressions.
if (leafMember.getQuantifiers().isEmpty()) {
final Iterable<BoundMatch<MatchInfo>> boundMatchInfos = matchWithCandidate(expression, leafMember);
// yield any match to the planner
boundMatchInfos.forEach(boundMatchInfo -> call.yieldPartialMatch(boundMatchInfo.getAliasMap(), matchCandidate, expression, leafRef, boundMatchInfo.getMatchResult()));
}
}
}
}
}
Aggregations