Search in sources :

Example 16 with QueryPredicate

use of com.apple.foundationdb.record.query.predicates.QueryPredicate in project fdb-record-layer by FoundationDB.

the class CombineFilterRule method onMatch.

@Override
public void onMatch(@Nonnull PlannerRuleCall call) {
    final PlannerBindings bindings = call.getBindings();
    final ExpressionRef<?> inner = bindings.get(innerMatcher);
    final Quantifier.ForEach lowerQun = bindings.get(lowerQunMatcher);
    final List<? extends QueryPredicate> lowerPreds = bindings.getAll(lowerMatcher);
    final Quantifier.ForEach upperQun = call.get(upperQunMatcher);
    final List<? extends QueryPredicate> upperPreds = bindings.getAll(upperMatcher);
    final Quantifier.ForEach newUpperQun = Quantifier.forEach(inner, upperQun.getAlias());
    final List<? extends QueryPredicate> newLowerPred = lowerPreds.stream().map(lowerPred -> lowerPred.rebase(Quantifiers.translate(lowerQun, newUpperQun))).collect(ImmutableList.toImmutableList());
    call.yield(call.ref(new LogicalFilterExpression(Iterables.concat(upperPreds, newLowerPred), newUpperQun)));
}
Also used : PlannerRuleCall(com.apple.foundationdb.record.query.plan.temp.PlannerRuleCall) Iterables(com.google.common.collect.Iterables) PlannerRule(com.apple.foundationdb.record.query.plan.temp.PlannerRule) QueryPredicateMatchers.anyPredicate(com.apple.foundationdb.record.query.plan.temp.matchers.QueryPredicateMatchers.anyPredicate) Quantifier(com.apple.foundationdb.record.query.plan.temp.Quantifier) MultiMatcher.all(com.apple.foundationdb.record.query.plan.temp.matchers.MultiMatcher.all) PlannerBindings(com.apple.foundationdb.record.query.plan.temp.matchers.PlannerBindings) QueryPredicate(com.apple.foundationdb.record.query.predicates.QueryPredicate) Quantifiers(com.apple.foundationdb.record.query.plan.temp.Quantifiers) LogicalFilterExpression(com.apple.foundationdb.record.query.plan.temp.expressions.LogicalFilterExpression) RelationalExpressionMatchers.logicalFilterExpression(com.apple.foundationdb.record.query.plan.temp.matchers.RelationalExpressionMatchers.logicalFilterExpression) RelationalExpression(com.apple.foundationdb.record.query.plan.temp.RelationalExpression) ReferenceMatchers.anyRef(com.apple.foundationdb.record.query.plan.temp.matchers.ReferenceMatchers.anyRef) List(java.util.List) BindingMatcher(com.apple.foundationdb.record.query.plan.temp.matchers.BindingMatcher) ImmutableList(com.google.common.collect.ImmutableList) API(com.apple.foundationdb.annotation.API) QuantifierMatchers.forEachQuantifierOverRef(com.apple.foundationdb.record.query.plan.temp.matchers.QuantifierMatchers.forEachQuantifierOverRef) ExpressionRef(com.apple.foundationdb.record.query.plan.temp.ExpressionRef) ListMatcher.exactly(com.apple.foundationdb.record.query.plan.temp.matchers.ListMatcher.exactly) QuantifierMatchers.forEachQuantifier(com.apple.foundationdb.record.query.plan.temp.matchers.QuantifierMatchers.forEachQuantifier) Nonnull(javax.annotation.Nonnull) PlannerBindings(com.apple.foundationdb.record.query.plan.temp.matchers.PlannerBindings) LogicalFilterExpression(com.apple.foundationdb.record.query.plan.temp.expressions.LogicalFilterExpression) Quantifier(com.apple.foundationdb.record.query.plan.temp.Quantifier) QuantifierMatchers.forEachQuantifier(com.apple.foundationdb.record.query.plan.temp.matchers.QuantifierMatchers.forEachQuantifier)

Example 17 with QueryPredicate

use of com.apple.foundationdb.record.query.predicates.QueryPredicate in project fdb-record-layer by FoundationDB.

the class AbstractDataAccessRule method computeBoundKeyPartMap.

@Nonnull
private static Map<QueryPredicate, BoundKeyPart> computeBoundKeyPartMap(final PartialMatch partialMatch) {
    final MatchInfo matchInfo = partialMatch.getMatchInfo();
    final Map<CorrelationIdentifier, ComparisonRange> boundParameterPrefixMap = partialMatch.getBoundParameterPrefixMap();
    return matchInfo.getBoundKeyParts().stream().filter(boundKeyPart -> {
        // make sure that matching actually bound the part and that it can be used in a scan
        return matchInfo.getParameterAliasForBoundKeyPart(boundKeyPart).map(boundParameterPrefixMap::containsKey).orElse(false);
    }).peek(// make sure we got a predicate mapping
    boundKeyPart -> Objects.requireNonNull(boundKeyPart.getQueryPredicate())).collect(Collectors.toMap(BoundKeyPart::getQueryPredicate, Function.identity(), (a, b) -> {
        if (matchInfo.getCandidatePredicateForBoundKeyPart(a) == matchInfo.getCandidatePredicateForBoundKeyPart(b) && a.getComparisonRangeType() == b.getComparisonRangeType()) {
            return a;
        }
        throw new RecordCoreException("merge conflict");
    }, Maps::newIdentityHashMap));
}
Also used : PlannerRuleCall(com.apple.foundationdb.record.query.plan.temp.PlannerRuleCall) OrderingAttribute(com.apple.foundationdb.record.query.plan.temp.OrderingAttribute) CascadesPlanner(com.apple.foundationdb.record.query.plan.temp.CascadesPlanner) LinkedIdentitySet(com.apple.foundationdb.record.query.plan.temp.LinkedIdentitySet) GroupExpressionRef(com.apple.foundationdb.record.query.plan.temp.GroupExpressionRef) PartialMatch(com.apple.foundationdb.record.query.plan.temp.PartialMatch) Pair(org.apache.commons.lang3.tuple.Pair) RecordCoreException(com.apple.foundationdb.record.RecordCoreException) ComparisonRange(com.apple.foundationdb.record.query.plan.temp.ComparisonRange) Map(java.util.Map) IndexScanExpression(com.apple.foundationdb.record.query.plan.temp.expressions.IndexScanExpression) MatchCandidate(com.apple.foundationdb.record.query.plan.temp.MatchCandidate) PrimaryScanExpression(com.apple.foundationdb.record.query.plan.temp.expressions.PrimaryScanExpression) RequestedOrdering(com.apple.foundationdb.record.query.plan.temp.RequestedOrdering) KeyExpression(com.apple.foundationdb.record.metadata.expressions.KeyExpression) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) MatchPartition(com.apple.foundationdb.record.query.plan.temp.MatchPartition) Set(java.util.Set) PlannerBindings(com.apple.foundationdb.record.query.plan.temp.matchers.PlannerBindings) ReferencedFieldsAttribute(com.apple.foundationdb.record.query.plan.temp.ReferencedFieldsAttribute) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) BoundKeyPart(com.apple.foundationdb.record.query.plan.temp.BoundKeyPart) List(java.util.List) Stream(java.util.stream.Stream) CorrelationIdentifier(com.apple.foundationdb.record.query.plan.temp.CorrelationIdentifier) MatchInfo(com.apple.foundationdb.record.query.plan.temp.MatchInfo) Optional(java.util.Optional) API(com.apple.foundationdb.annotation.API) IntStream(java.util.stream.IntStream) Iterables(com.google.common.collect.Iterables) PlannerRule(com.apple.foundationdb.record.query.plan.temp.PlannerRule) Quantifier(com.apple.foundationdb.record.query.plan.temp.Quantifier) Ordering(com.apple.foundationdb.record.query.plan.temp.Ordering) Function(java.util.function.Function) Key(com.apple.foundationdb.record.metadata.Key) LinkedHashMap(java.util.LinkedHashMap) Lists(com.google.common.collect.Lists) ImmutableList(com.google.common.collect.ImmutableList) Compensation(com.apple.foundationdb.record.query.plan.temp.Compensation) StreamSupport(java.util.stream.StreamSupport) ExpressionRef(com.apple.foundationdb.record.query.plan.temp.ExpressionRef) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) ChooseK(com.apple.foundationdb.record.query.combinatorics.ChooseK) LogicalIntersectionExpression(com.apple.foundationdb.record.query.plan.temp.expressions.LogicalIntersectionExpression) Iterator(java.util.Iterator) LogicalDistinctExpression(com.apple.foundationdb.record.query.plan.temp.expressions.LogicalDistinctExpression) PartialOrder(com.apple.foundationdb.record.query.combinatorics.PartialOrder) QueryPredicate(com.apple.foundationdb.record.query.predicates.QueryPredicate) KeyPart(com.apple.foundationdb.record.query.plan.temp.KeyPart) Maps(com.google.common.collect.Maps) RelationalExpression(com.apple.foundationdb.record.query.plan.temp.RelationalExpression) BindingMatcher(com.apple.foundationdb.record.query.plan.temp.matchers.BindingMatcher) PrimaryScanMatchCandidate(com.apple.foundationdb.record.query.plan.temp.PrimaryScanMatchCandidate) Comparator(java.util.Comparator) ValueIndexScanMatchCandidate(com.apple.foundationdb.record.query.plan.temp.ValueIndexScanMatchCandidate) RecordCoreException(com.apple.foundationdb.record.RecordCoreException) MatchInfo(com.apple.foundationdb.record.query.plan.temp.MatchInfo) CorrelationIdentifier(com.apple.foundationdb.record.query.plan.temp.CorrelationIdentifier) ComparisonRange(com.apple.foundationdb.record.query.plan.temp.ComparisonRange) Nonnull(javax.annotation.Nonnull)

Example 18 with QueryPredicate

use of com.apple.foundationdb.record.query.predicates.QueryPredicate in project fdb-record-layer by FoundationDB.

the class PushTypeFilterBelowFilterRule method onMatch.

@Override
public void onMatch(@Nonnull PlannerRuleCall call) {
    final PlannerBindings bindings = call.getBindings();
    final ExpressionRef<? extends RelationalExpression> inner = bindings.get(innerMatcher);
    final Quantifier.Physical qun = bindings.get(qunMatcher);
    final List<? extends QueryPredicate> predicates = bindings.getAll(predMatcher);
    final Collection<String> recordTypes = bindings.get(root).getRecordTypes();
    final RecordQueryTypeFilterPlan newTypeFilterPlan = new RecordQueryTypeFilterPlan(Quantifier.physical(inner), recordTypes);
    final Quantifier.Physical newQun = Quantifier.physical(call.ref(newTypeFilterPlan));
    final List<QueryPredicate> rebasedPredicates = predicates.stream().map(queryPredicate -> queryPredicate.rebase(Quantifiers.translate(qun, newQun))).collect(ImmutableList.toImmutableList());
    call.yield(GroupExpressionRef.of(new RecordQueryPredicatesFilterPlan(newQun, rebasedPredicates)));
}
Also used : PlannerRuleCall(com.apple.foundationdb.record.query.plan.temp.PlannerRuleCall) RecordQueryFilterPlan(com.apple.foundationdb.record.query.plan.plans.RecordQueryFilterPlan) PlannerRule(com.apple.foundationdb.record.query.plan.temp.PlannerRule) Quantifier(com.apple.foundationdb.record.query.plan.temp.Quantifier) Quantifiers(com.apple.foundationdb.record.query.plan.temp.Quantifiers) GroupExpressionRef(com.apple.foundationdb.record.query.plan.temp.GroupExpressionRef) RecordQueryPlanMatchers.predicatesFilter(com.apple.foundationdb.record.query.plan.temp.matchers.RecordQueryPlanMatchers.predicatesFilter) ImmutableList(com.google.common.collect.ImmutableList) RecordQueryPlanMatchers.typeFilter(com.apple.foundationdb.record.query.plan.temp.matchers.RecordQueryPlanMatchers.typeFilter) ReferenceMatchers.anyRefOverOnlyPlans(com.apple.foundationdb.record.query.plan.temp.matchers.ReferenceMatchers.anyRefOverOnlyPlans) ExpressionRef(com.apple.foundationdb.record.query.plan.temp.ExpressionRef) Nonnull(javax.annotation.Nonnull) QuantifierMatchers.physicalQuantifier(com.apple.foundationdb.record.query.plan.temp.matchers.QuantifierMatchers.physicalQuantifier) QueryPredicateMatchers.anyPredicate(com.apple.foundationdb.record.query.plan.temp.matchers.QueryPredicateMatchers.anyPredicate) Collection(java.util.Collection) MultiMatcher.all(com.apple.foundationdb.record.query.plan.temp.matchers.MultiMatcher.all) PlannerBindings(com.apple.foundationdb.record.query.plan.temp.matchers.PlannerBindings) QueryPredicate(com.apple.foundationdb.record.query.predicates.QueryPredicate) RecordQueryPredicatesFilterPlan(com.apple.foundationdb.record.query.plan.plans.RecordQueryPredicatesFilterPlan) QuantifierMatchers.physicalQuantifierOverRef(com.apple.foundationdb.record.query.plan.temp.matchers.QuantifierMatchers.physicalQuantifierOverRef) RelationalExpression(com.apple.foundationdb.record.query.plan.temp.RelationalExpression) List(java.util.List) BindingMatcher(com.apple.foundationdb.record.query.plan.temp.matchers.BindingMatcher) API(com.apple.foundationdb.annotation.API) RecordQueryTypeFilterPlan(com.apple.foundationdb.record.query.plan.plans.RecordQueryTypeFilterPlan) ListMatcher.exactly(com.apple.foundationdb.record.query.plan.temp.matchers.ListMatcher.exactly) QueryPredicate(com.apple.foundationdb.record.query.predicates.QueryPredicate) RecordQueryPredicatesFilterPlan(com.apple.foundationdb.record.query.plan.plans.RecordQueryPredicatesFilterPlan) PlannerBindings(com.apple.foundationdb.record.query.plan.temp.matchers.PlannerBindings) Quantifier(com.apple.foundationdb.record.query.plan.temp.Quantifier) QuantifierMatchers.physicalQuantifier(com.apple.foundationdb.record.query.plan.temp.matchers.QuantifierMatchers.physicalQuantifier) RecordQueryTypeFilterPlan(com.apple.foundationdb.record.query.plan.plans.RecordQueryTypeFilterPlan)

Example 19 with QueryPredicate

use of com.apple.foundationdb.record.query.predicates.QueryPredicate in project fdb-record-layer by FoundationDB.

the class MatchableSortExpression method forPartialMatch.

/**
 * This synthesizes a list of {@link BoundKeyPart}s from the current partial match and the ordering information
 * contained in this expression. Using the list of parameter ids, each {@link BoundKeyPart} links together the
 * (1) normalized key expression that originally produced the key (from index, or common primary key)
 * (2) a comparison range for this parameter which is contained in the already existent partial match
 * (3) the predicate on the query part that participated and bound this parameter (and implicitly was used to
 *     synthesize the comparison range in (2)
 * (4) the candidate predicate on the candidate side that is the {@link Placeholder} for the parameter
 * @param partialMatch the pre-existing partial match on {@code (expression, this)} that the caller wants to adjust.
 * @return a list of bound key parts that express the order of the outgoing data stream and their respective mappings
 *         between query and match candidate
 */
@Nonnull
private List<BoundKeyPart> forPartialMatch(@Nonnull PartialMatch partialMatch) {
    final MatchCandidate matchCandidate = partialMatch.getMatchCandidate();
    final MatchInfo matchInfo = partialMatch.getMatchInfo();
    final Map<CorrelationIdentifier, ComparisonRange> parameterBindingMap = matchInfo.getParameterBindingMap();
    final PredicateMap accumulatedPredicateMap = matchInfo.getAccumulatedPredicateMap();
    final ImmutableMap<CorrelationIdentifier, QueryPredicate> parameterBindingPredicateMap = accumulatedPredicateMap.entries().stream().filter(entry -> {
        final PredicateMapping predicateMapping = entry.getValue();
        return predicateMapping.getParameterAliasOptional().isPresent();
    }).collect(ImmutableMap.toImmutableMap(entry -> {
        final PredicateMapping predicateMapping = entry.getValue();
        return Objects.requireNonNull(predicateMapping.getParameterAliasOptional().orElseThrow(() -> new RecordCoreException("parameter alias should have been set")));
    }, entry -> Objects.requireNonNull(entry.getKey())));
    final List<KeyExpression> normalizedKeys = matchCandidate.getAlternativeKeyExpression().normalizeKeyForPositions();
    final ImmutableList.Builder<BoundKeyPart> builder = ImmutableList.builder();
    final List<CorrelationIdentifier> candidateParameterIds = matchCandidate.getParameters();
    for (final CorrelationIdentifier parameterId : sortParameterIds) {
        final int ordinalInCandidate = candidateParameterIds.indexOf(parameterId);
        Verify.verify(ordinalInCandidate >= 0);
        final KeyExpression normalizedKey = normalizedKeys.get(ordinalInCandidate);
        Objects.requireNonNull(parameterId);
        Objects.requireNonNull(normalizedKey);
        @Nullable final ComparisonRange comparisonRange = parameterBindingMap.get(parameterId);
        @Nullable final QueryPredicate queryPredicate = parameterBindingPredicateMap.get(parameterId);
        Verify.verify(comparisonRange == null || comparisonRange.getRangeType() == ComparisonRange.Type.EMPTY || queryPredicate != null);
        builder.add(BoundKeyPart.of(normalizedKey, comparisonRange == null ? ComparisonRange.Type.EMPTY : comparisonRange.getRangeType(), queryPredicate, isReverse));
    }
    return builder.build();
}
Also used : Iterables(com.google.common.collect.Iterables) Quantifier(com.apple.foundationdb.record.query.plan.temp.Quantifier) GroupExpressionRef(com.apple.foundationdb.record.query.plan.temp.GroupExpressionRef) Supplier(java.util.function.Supplier) PredicateMap(com.apple.foundationdb.record.query.plan.temp.PredicateMap) PartialMatch(com.apple.foundationdb.record.query.plan.temp.PartialMatch) ImmutableList(com.google.common.collect.ImmutableList) RecordCoreException(com.apple.foundationdb.record.RecordCoreException) ComparisonRange(com.apple.foundationdb.record.query.plan.temp.ComparisonRange) Attribute(com.apple.foundationdb.record.query.plan.temp.explain.Attribute) Map(java.util.Map) MatchCandidate(com.apple.foundationdb.record.query.plan.temp.MatchCandidate) Placeholder(com.apple.foundationdb.record.query.predicates.ValueComparisonRangePredicate.Placeholder) AliasMap(com.apple.foundationdb.record.query.plan.temp.AliasMap) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) PredicateMapping(com.apple.foundationdb.record.query.plan.temp.PredicateMultiMap.PredicateMapping) KeyExpression(com.apple.foundationdb.record.metadata.expressions.KeyExpression) AdjustMatchRule(com.apple.foundationdb.record.query.plan.temp.rules.AdjustMatchRule) Verify(com.google.common.base.Verify) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) Set(java.util.Set) InternalPlannerGraphRewritable(com.apple.foundationdb.record.query.plan.temp.explain.InternalPlannerGraphRewritable) QueryPredicate(com.apple.foundationdb.record.query.predicates.QueryPredicate) RelationalExpression(com.apple.foundationdb.record.query.plan.temp.RelationalExpression) Objects(java.util.Objects) BoundKeyPart(com.apple.foundationdb.record.query.plan.temp.BoundKeyPart) Value(com.apple.foundationdb.record.query.predicates.Value) List(java.util.List) CorrelationIdentifier(com.apple.foundationdb.record.query.plan.temp.CorrelationIdentifier) MatchInfo(com.apple.foundationdb.record.query.plan.temp.MatchInfo) Optional(java.util.Optional) RemoveSortRule(com.apple.foundationdb.record.query.plan.temp.rules.RemoveSortRule) API(com.apple.foundationdb.annotation.API) PlannerGraph(com.apple.foundationdb.record.query.plan.temp.explain.PlannerGraph) NodeInfo(com.apple.foundationdb.record.query.plan.temp.explain.NodeInfo) QueryPredicate(com.apple.foundationdb.record.query.predicates.QueryPredicate) ImmutableList(com.google.common.collect.ImmutableList) KeyExpression(com.apple.foundationdb.record.metadata.expressions.KeyExpression) PredicateMap(com.apple.foundationdb.record.query.plan.temp.PredicateMap) BoundKeyPart(com.apple.foundationdb.record.query.plan.temp.BoundKeyPart) PredicateMapping(com.apple.foundationdb.record.query.plan.temp.PredicateMultiMap.PredicateMapping) RecordCoreException(com.apple.foundationdb.record.RecordCoreException) MatchInfo(com.apple.foundationdb.record.query.plan.temp.MatchInfo) CorrelationIdentifier(com.apple.foundationdb.record.query.plan.temp.CorrelationIdentifier) MatchCandidate(com.apple.foundationdb.record.query.plan.temp.MatchCandidate) ComparisonRange(com.apple.foundationdb.record.query.plan.temp.ComparisonRange) Nullable(javax.annotation.Nullable) Nonnull(javax.annotation.Nonnull)

Example 20 with QueryPredicate

use of com.apple.foundationdb.record.query.predicates.QueryPredicate in project fdb-record-layer by FoundationDB.

the class SelectExpression method partitionPredicates.

private static List<? extends QueryPredicate> partitionPredicates(final List<? extends QueryPredicate> predicates) {
    final ImmutableList<QueryPredicate> flattenedAndPredicates = predicates.stream().flatMap(predicate -> flattenAndPredicate(predicate).stream()).collect(ImmutableList.toImmutableList());
    // partition predicates in value-based predicates and non-value-based predicates
    final ImmutableList.Builder<PredicateWithValue> predicateWithValuesBuilder = ImmutableList.builder();
    final ImmutableList.Builder<QueryPredicate> resultPredicatesBuilder = ImmutableList.builder();
    for (final QueryPredicate flattenedAndPredicate : flattenedAndPredicates) {
        if (flattenedAndPredicate instanceof PredicateWithValue) {
            predicateWithValuesBuilder.add((PredicateWithValue) flattenedAndPredicate);
        } else {
            resultPredicatesBuilder.add(flattenedAndPredicate);
        }
    }
    final ImmutableList<PredicateWithValue> predicateWithValues = predicateWithValuesBuilder.build();
    final AliasMap boundIdentitiesMap = AliasMap.identitiesFor(flattenedAndPredicates.stream().flatMap(predicate -> predicate.getCorrelatedTo().stream()).collect(ImmutableSet.toImmutableSet()));
    final BoundEquivalence boundEquivalence = new BoundEquivalence(boundIdentitiesMap);
    final HashMultimap<Equivalence.Wrapper<Value>, PredicateWithValue> partitionedPredicatesWithValues = predicateWithValues.stream().collect(Multimaps.toMultimap(predicate -> boundEquivalence.wrap(predicate.getValue()), Function.identity(), HashMultimap::create));
    partitionedPredicatesWithValues.asMap().forEach((valueWrapper, predicatesOnValue) -> {
        final Value value = Objects.requireNonNull(valueWrapper.get());
        ComparisonRange resultRange = ComparisonRange.EMPTY;
        for (final PredicateWithValue predicateOnValue : predicatesOnValue) {
            if (predicateOnValue instanceof ValuePredicate) {
                final Comparisons.Comparison comparison = ((ValuePredicate) predicateOnValue).getComparison();
                final ComparisonRange.MergeResult mergeResult = resultRange.merge(comparison);
                resultRange = mergeResult.getComparisonRange();
                mergeResult.getResidualComparisons().forEach(residualComparison -> resultPredicatesBuilder.add(value.withComparison(residualComparison)));
            } else if (predicateOnValue instanceof Sargable) {
                final Sargable valueComparisonRangePredicate = (Sargable) predicateOnValue;
                final ComparisonRange comparisonRange = valueComparisonRangePredicate.getComparisonRange();
                final ComparisonRange.MergeResult mergeResult = resultRange.merge(comparisonRange);
                resultRange = mergeResult.getComparisonRange();
                mergeResult.getResidualComparisons().forEach(residualComparison -> resultPredicatesBuilder.add(value.withComparison(residualComparison)));
            } else {
                resultPredicatesBuilder.add(predicateOnValue);
            }
        }
        if (!resultRange.isEmpty()) {
            resultPredicatesBuilder.add(ValueComparisonRangePredicate.sargable(value, resultRange));
        }
    });
    return resultPredicatesBuilder.build();
}
Also used : ValuePredicate(com.apple.foundationdb.record.query.predicates.ValuePredicate) RelationalExpressionWithPredicates(com.apple.foundationdb.record.query.plan.temp.RelationalExpressionWithPredicates) Quantifier(com.apple.foundationdb.record.query.plan.temp.Quantifier) PredicateWithValue(com.apple.foundationdb.record.query.predicates.PredicateWithValue) ValueComparisonRangePredicate(com.apple.foundationdb.record.query.predicates.ValueComparisonRangePredicate) Function(java.util.function.Function) PredicateMap(com.apple.foundationdb.record.query.plan.temp.PredicateMap) Multimaps(com.google.common.collect.Multimaps) PartialMatch(com.apple.foundationdb.record.query.plan.temp.PartialMatch) HashMultimap(com.google.common.collect.HashMultimap) ImmutableList(com.google.common.collect.ImmutableList) ComparisonRange(com.apple.foundationdb.record.query.plan.temp.ComparisonRange) IterableHelpers(com.apple.foundationdb.record.query.plan.temp.IterableHelpers) Map(java.util.Map) Compensation(com.apple.foundationdb.record.query.plan.temp.Compensation) IdentityBiMap(com.apple.foundationdb.record.query.plan.temp.IdentityBiMap) Placeholder(com.apple.foundationdb.record.query.predicates.ValueComparisonRangePredicate.Placeholder) AliasMap(com.apple.foundationdb.record.query.plan.temp.AliasMap) Nonnull(javax.annotation.Nonnull) PredicateMapping(com.apple.foundationdb.record.query.plan.temp.PredicateMultiMap.PredicateMapping) Verify(com.google.common.base.Verify) ImmutableSet(com.google.common.collect.ImmutableSet) Equivalence(com.google.common.base.Equivalence) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) Set(java.util.Set) InternalPlannerGraphRewritable(com.apple.foundationdb.record.query.plan.temp.explain.InternalPlannerGraphRewritable) QueryPredicate(com.apple.foundationdb.record.query.predicates.QueryPredicate) EnumeratingIterable(com.apple.foundationdb.record.query.combinatorics.EnumeratingIterable) Streams(com.google.common.collect.Streams) AndPredicate(com.apple.foundationdb.record.query.predicates.AndPredicate) Maps(com.google.common.collect.Maps) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) RelationalExpression(com.apple.foundationdb.record.query.plan.temp.RelationalExpression) Objects(java.util.Objects) Value(com.apple.foundationdb.record.query.predicates.Value) Comparisons(com.apple.foundationdb.record.query.expressions.Comparisons) List(java.util.List) Stream(java.util.stream.Stream) Sargable(com.apple.foundationdb.record.query.predicates.ValueComparisonRangePredicate.Sargable) CorrelationIdentifier(com.apple.foundationdb.record.query.plan.temp.CorrelationIdentifier) CrossProduct(com.apple.foundationdb.record.query.combinatorics.CrossProduct) MatchInfo(com.apple.foundationdb.record.query.plan.temp.MatchInfo) Optional(java.util.Optional) API(com.apple.foundationdb.annotation.API) PlannerGraph(com.apple.foundationdb.record.query.plan.temp.explain.PlannerGraph) Sargable(com.apple.foundationdb.record.query.predicates.ValueComparisonRangePredicate.Sargable) QueryPredicate(com.apple.foundationdb.record.query.predicates.QueryPredicate) ImmutableList(com.google.common.collect.ImmutableList) PredicateWithValue(com.apple.foundationdb.record.query.predicates.PredicateWithValue) AliasMap(com.apple.foundationdb.record.query.plan.temp.AliasMap) Comparisons(com.apple.foundationdb.record.query.expressions.Comparisons) ValuePredicate(com.apple.foundationdb.record.query.predicates.ValuePredicate) PredicateWithValue(com.apple.foundationdb.record.query.predicates.PredicateWithValue) Value(com.apple.foundationdb.record.query.predicates.Value) ComparisonRange(com.apple.foundationdb.record.query.plan.temp.ComparisonRange)

Aggregations

QueryPredicate (com.apple.foundationdb.record.query.predicates.QueryPredicate)22 Quantifier (com.apple.foundationdb.record.query.plan.temp.Quantifier)14 ImmutableList (com.google.common.collect.ImmutableList)14 Nonnull (javax.annotation.Nonnull)13 List (java.util.List)12 API (com.apple.foundationdb.annotation.API)10 RelationalExpression (com.apple.foundationdb.record.query.plan.temp.RelationalExpression)10 PlannerBindings (com.apple.foundationdb.record.query.plan.temp.matchers.PlannerBindings)9 CorrelationIdentifier (com.apple.foundationdb.record.query.plan.temp.CorrelationIdentifier)8 ImmutableSet (com.google.common.collect.ImmutableSet)7 Collection (java.util.Collection)7 Objects (java.util.Objects)7 Optional (java.util.Optional)7 Collectors (java.util.stream.Collectors)7 ComparisonRange (com.apple.foundationdb.record.query.plan.temp.ComparisonRange)6 ExpressionRef (com.apple.foundationdb.record.query.plan.temp.ExpressionRef)6 GroupExpressionRef (com.apple.foundationdb.record.query.plan.temp.GroupExpressionRef)6 MatchInfo (com.apple.foundationdb.record.query.plan.temp.MatchInfo)6 PartialMatch (com.apple.foundationdb.record.query.plan.temp.PartialMatch)6 Value (com.apple.foundationdb.record.query.predicates.Value)6