use of com.apple.foundationdb.record.query.plan.temp.PlannerRule in project fdb-record-layer by FoundationDB.
the class TestRuleExecution method applyRule.
public static TestRuleExecution applyRule(@Nonnull PlanContext context, @Nonnull PlannerRule<? extends RelationalExpression> rule, @Nonnull GroupExpressionRef<RelationalExpression> group) {
boolean ruleMatched = false;
for (RelationalExpression expression : group.getMembers()) {
final Iterator<CascadesRuleCall> ruleCalls = rule.getMatcher().bindMatches(PlannerBindings.empty(), expression).map(bindings -> new CascadesRuleCall(context, rule, group, Quantifiers.AliasResolver.withRoot(group), bindings)).iterator();
while (ruleCalls.hasNext()) {
ruleCalls.next().run();
ruleMatched = true;
}
}
return new TestRuleExecution(ruleMatched, group);
}
Aggregations