Search in sources :

Example 1 with CascadesRuleCall

use of com.apple.foundationdb.record.query.plan.temp.CascadesRuleCall 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);
}
Also used : RelationalExpression(com.apple.foundationdb.record.query.plan.temp.RelationalExpression) Iterator(java.util.Iterator) PlannerRule(com.apple.foundationdb.record.query.plan.temp.PlannerRule) PlanContext(com.apple.foundationdb.record.query.plan.temp.PlanContext) PlannerBindings(com.apple.foundationdb.record.query.plan.temp.matchers.PlannerBindings) Quantifiers(com.apple.foundationdb.record.query.plan.temp.Quantifiers) GroupExpressionRef(com.apple.foundationdb.record.query.plan.temp.GroupExpressionRef) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) CascadesRuleCall(com.apple.foundationdb.record.query.plan.temp.CascadesRuleCall) RelationalExpression(com.apple.foundationdb.record.query.plan.temp.RelationalExpression) CascadesRuleCall(com.apple.foundationdb.record.query.plan.temp.CascadesRuleCall)

Aggregations

CascadesRuleCall (com.apple.foundationdb.record.query.plan.temp.CascadesRuleCall)1 GroupExpressionRef (com.apple.foundationdb.record.query.plan.temp.GroupExpressionRef)1 PlanContext (com.apple.foundationdb.record.query.plan.temp.PlanContext)1 PlannerRule (com.apple.foundationdb.record.query.plan.temp.PlannerRule)1 Quantifiers (com.apple.foundationdb.record.query.plan.temp.Quantifiers)1 RelationalExpression (com.apple.foundationdb.record.query.plan.temp.RelationalExpression)1 PlannerBindings (com.apple.foundationdb.record.query.plan.temp.matchers.PlannerBindings)1 Iterator (java.util.Iterator)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1