use of com.apple.foundationdb.record.query.plan.temp.ReferencedFieldsAttribute.ReferencedFields in project fdb-record-layer by FoundationDB.
the class PushReferencedFieldsThroughDistinctRule method onMatch.
@Override
public void onMatch(@Nonnull PlannerRuleCall call) {
final PlannerBindings bindings = call.getBindings();
final ExpressionRef<? extends RelationalExpression> lowerRef = bindings.get(lowerRefMatcher);
final Optional<ReferencedFields> referencedFieldsOptional = call.getInterestingProperty(ReferencedFieldsAttribute.REFERENCED_FIELDS);
if (!referencedFieldsOptional.isPresent()) {
return;
}
call.pushRequirement(lowerRef, ReferencedFieldsAttribute.REFERENCED_FIELDS, referencedFieldsOptional.get());
}
use of com.apple.foundationdb.record.query.plan.temp.ReferencedFieldsAttribute.ReferencedFields in project fdb-record-layer by FoundationDB.
the class PushReferencedFieldsThroughSelectRule method onMatch.
@Override
public void onMatch(@Nonnull PlannerRuleCall call) {
final PlannerBindings bindings = call.getBindings();
final SelectExpression selectExpression = bindings.get(root);
final List<? extends QueryPredicate> predicates = bindings.getAll(predicateMatcher);
final Set<FieldValue> fieldValuesFromPredicates = RelationalExpressionWithPredicates.fieldValuesFromPredicates(predicates);
final Set<FieldValue> fieldValuesFromResultValues = selectExpression.getFieldValuesFromResultValues();
final ExpressionRef<? extends RelationalExpression> lowerRef = bindings.get(lowerRefMatcher);
final ImmutableSet<FieldValue> allReferencedValues = ImmutableSet.<FieldValue>builder().addAll(call.getInterestingProperty(ReferencedFieldsAttribute.REFERENCED_FIELDS).map(ReferencedFields::getReferencedFieldValues).orElse(ImmutableSet.of())).addAll(fieldValuesFromPredicates).addAll(fieldValuesFromResultValues).build();
call.pushRequirement(lowerRef, ReferencedFieldsAttribute.REFERENCED_FIELDS, new ReferencedFields(allReferencedValues));
}
use of com.apple.foundationdb.record.query.plan.temp.ReferencedFieldsAttribute.ReferencedFields in project fdb-record-layer by FoundationDB.
the class PushReferencedFieldsThroughFilterRule method onMatch.
@Override
public void onMatch(@Nonnull PlannerRuleCall call) {
final PlannerBindings bindings = call.getBindings();
final List<? extends QueryPredicate> predicates = bindings.getAll(predicateMatcher);
final Set<FieldValue> fieldValuesFromPredicates = RelationalExpressionWithPredicates.fieldValuesFromPredicates(predicates);
final ExpressionRef<? extends RelationalExpression> lowerRef = bindings.get(lowerRefMatcher);
final ImmutableSet<FieldValue> allReferencedValues = ImmutableSet.<FieldValue>builder().addAll(call.getInterestingProperty(ReferencedFieldsAttribute.REFERENCED_FIELDS).map(ReferencedFields::getReferencedFieldValues).orElse(ImmutableSet.of())).addAll(fieldValuesFromPredicates).build();
call.pushRequirement(lowerRef, ReferencedFieldsAttribute.REFERENCED_FIELDS, new ReferencedFields(allReferencedValues));
}
Aggregations