Skip to content

Commit 5ff59a1

Browse files
committed
some polishing
1 parent 16e3ab7 commit 5ff59a1

File tree

8 files changed

+18
-51
lines changed

8 files changed

+18
-51
lines changed

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/combinatorics/TopologicalSort.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,6 @@ public static <T, P> Iterable<List<T>> satisfyingPermutations(@Nonnull final Par
537537
@Nonnull final List<P> targetPermutation,
538538
@Nonnull final Function<T, P> domainMapper,
539539
@Nonnull final Function<List<T>, Integer> satisfiabilityFunction) {
540-
// if (partiallyOrderedSet.isEmpty()) {
541-
// return ImmutableList.of();
542-
// }
543-
544540
if (partiallyOrderedSet.size() < targetPermutation.size()) {
545541
return ImmutableList.of();
546542
}

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/AggregateIndexExpansionVisitor.java

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import com.apple.foundationdb.record.query.plan.cascades.values.RecordConstructorValue;
4646
import com.apple.foundationdb.record.query.plan.cascades.values.Value;
4747
import com.apple.foundationdb.record.query.plan.cascades.values.Values;
48-
import com.apple.foundationdb.record.query.plan.cascades.values.translation.TranslationMap;
4948
import com.apple.foundationdb.record.util.pair.NonnullPair;
5049
import com.google.common.base.Preconditions;
5150
import com.google.common.base.Suppliers;
@@ -163,8 +162,7 @@ public MatchCandidate expand(@Nonnull final Supplier<Quantifier.ForEach> baseQua
163162
recordTypes,
164163
baseQuantifier.getFlowedObjectType(),
165164
groupByQun.getRangesOver().get().getResultValue(),
166-
selectHaving,
167-
constructSelectHavingResult.getGroupByValues());
165+
selectHaving);
168166
}
169167

170168
@Nonnull
@@ -338,12 +336,8 @@ private ConstructSelectHavingResult constructSelectHaving(@Nonnull final Quantif
338336
finalPlaceholders = placeholderAliases.build();
339337
}
340338

341-
final var currentGroupingValues = groupingValues.stream()
342-
.map(groupingValue -> groupingValue.translateCorrelations(TranslationMap.ofAliases(groupByQun.getAlias(), Quantifier.current())))
343-
.collect(ImmutableList.toImmutableList());
344-
345339
return new ConstructSelectHavingResult(selectHavingGraphExpansionBuilder.build().buildSelect(),
346-
finalPlaceholders, currentGroupingValues);
340+
finalPlaceholders);
347341
}
348342

349343
@Nonnull
@@ -394,15 +388,11 @@ private static class ConstructSelectHavingResult {
394388
private final SelectExpression selectExpression;
395389
@Nonnull
396390
private final List<CorrelationIdentifier> placeholderAliases;
397-
@Nonnull
398-
private final List<Value> groupByValues;
399391

400392
private ConstructSelectHavingResult(@Nonnull final SelectExpression selectExpression,
401-
@Nonnull final List<CorrelationIdentifier> placeholderAliases,
402-
@Nonnull final List<Value> groupByValues) {
393+
@Nonnull final List<CorrelationIdentifier> placeholderAliases) {
403394
this.selectExpression = selectExpression;
404395
this.placeholderAliases = placeholderAliases;
405-
this.groupByValues = groupByValues;
406396
}
407397

408398
@Nonnull
@@ -414,10 +404,5 @@ public SelectExpression getSelectExpression() {
414404
public List<CorrelationIdentifier> getPlaceholderAliases() {
415405
return placeholderAliases;
416406
}
417-
418-
@Nonnull
419-
public List<Value> getGroupByValues() {
420-
return groupByValues;
421-
}
422407
}
423408
}

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/AggregateIndexMatchCandidate.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ public class AggregateIndexMatchCandidate implements MatchCandidate, WithBaseQua
100100
@Nonnull
101101
private final SelectExpression selectHavingExpression;
102102

103-
@Nonnull
104-
private final List<Value> groupByValues;
105-
106103
/**
107104
* Creates a new instance of {@link AggregateIndexMatchCandidate}.
108105
*
@@ -120,8 +117,7 @@ public AggregateIndexMatchCandidate(@Nonnull final Index index,
120117
@Nonnull final Collection<RecordType> recordTypes,
121118
@Nonnull final Type baseType,
122119
@Nonnull final Value groupByResultValue,
123-
@Nonnull final SelectExpression selectHavingExpression,
124-
@Nonnull final List<Value> groupByValues) {
120+
@Nonnull final SelectExpression selectHavingExpression) {
125121
Preconditions.checkArgument(!recordTypes.isEmpty());
126122
this.index = index;
127123
this.traversal = traversal;
@@ -130,7 +126,6 @@ public AggregateIndexMatchCandidate(@Nonnull final Index index,
130126
this.baseType = baseType;
131127
this.groupByResultValue = groupByResultValue;
132128
this.selectHavingExpression = selectHavingExpression;
133-
this.groupByValues = ImmutableList.copyOf(groupByValues);
134129
}
135130

136131
@Nonnull
@@ -157,16 +152,6 @@ public List<CorrelationIdentifier> getOrderingAliases() {
157152
return sargableAndOrderAliases;
158153
}
159154

160-
@Nonnull
161-
public SelectExpression getSelectHavingExpression() {
162-
return selectHavingExpression;
163-
}
164-
165-
@Nonnull
166-
public List<Value> getGroupByValues() {
167-
return groupByValues;
168-
}
169-
170155
@Nonnull
171156
@Override
172157
public KeyExpression getFullKeyExpression() {

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/PredicateMultiMap.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public class PredicateMultiMap {
6666
private final SetMultimap<QueryPredicate, PredicateMapping> map;
6767

6868
@Nonnull
69-
private static Value amendValue(@Nonnull final BiMap<CorrelationIdentifier, Value> unmatchedAggregateMap,
70-
@Nonnull final Map<Value, Value> amendedMatchedAggregateMap,
71-
@Nonnull final Value rootValue) {
69+
private static Value replaceNewlyMatchedValues(@Nonnull final BiMap<CorrelationIdentifier, Value> unmatchedAggregateMap,
70+
@Nonnull final Map<Value, Value> amendedMatchedAggregateMap,
71+
@Nonnull final Value rootValue) {
7272
return Objects.requireNonNull(rootValue.replace(currentValue -> {
7373
if (currentValue instanceof GroupByExpression.UnmatchedAggregateValue) {
7474
final var unmatchedId =
@@ -191,7 +191,7 @@ public PredicateCompensationFunction amend(@Nonnull final BiMap<CorrelationIdent
191191
@Nonnull final Map<Value, Value> amendedMatchedAggregateMap) {
192192
final var amendedTranslatedPredicateOptional =
193193
predicate.replaceValuesMaybe(rootValue ->
194-
Optional.of(amendValue(unmatchedAggregateMap, amendedMatchedAggregateMap,
194+
Optional.of(replaceNewlyMatchedValues(unmatchedAggregateMap, amendedMatchedAggregateMap,
195195
rootValue)));
196196
Verify.verify(amendedTranslatedPredicateOptional.isPresent());
197197
return ofPredicate(amendedTranslatedPredicateOptional.get(), true);
@@ -405,7 +405,7 @@ public boolean isImpossible() {
405405
public ResultCompensationFunction amend(@Nonnull final BiMap<CorrelationIdentifier, Value> unmatchedAggregateMap,
406406
@Nonnull final Map<Value, Value> amendedMatchedAggregateMap) {
407407
final var amendedTranslatedQueryValue =
408-
amendValue(unmatchedAggregateMap, amendedMatchedAggregateMap, value);
408+
replaceNewlyMatchedValues(unmatchedAggregateMap, amendedMatchedAggregateMap, value);
409409
return ofValue(amendedTranslatedQueryValue, true);
410410
}
411411

fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/UnnestedRecordTypeTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,10 +2316,11 @@ void deleteWhereOnMultiTypeFailsWithAmbiguousParent() {
23162316

23172317
@Test
23182318
void deleteWhereOnMultiTypeFailsWithRecordTypePrefix() {
2319-
// Create a multi-type index on two different unnested types. Each one has a parent constituent named and an inner constituent, so the index is well-defined.
2320-
// The multi-type index in this case has a record type prefix. In theory, we actually could perform the delete records where, but the record type key in the
2321-
// index matches the synthetic type's record type key, not the base type. This means we'd need to translateCorrelations the record type key before deleting data from the
2322-
// index. Until we get that working, just assert that this fails.
2319+
// Create a multi-type index on two different unnested types. Each one has a parent constituent named and an
2320+
// inner constituent, so the index is well-defined. The multi-type index in this case has a record type prefix.
2321+
// In theory, we actually could perform the delete records where, but the record type key in the index matches
2322+
// the synthetic type's record type key, not the base type. This means we'd need to translate the record type
2323+
// key before deleting data from the index. Until we get that working, just assert that this fails.
23232324
final RecordMetaDataHook hook = addMultiTypeDoubleUnnestedIndex(concat(recordType(), field(PARENT_CONSTITUENT).nest(field("middle").nest("other_int")), field("inner").nest("foo")))
23242325
.andThen(setOuterAndMiddlePrimaryKey(concat(recordType(), field("middle").nest("other_int"), field("rec_no"))));
23252326
final RecordMetaData metaData = doubleNestedMetaData(hook);

fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/values/ValueTranslationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ translation of (t.a.q, t.a.r, (t.b.t), t.j.s) with correlation mapping of t -> t
723723
Assertions.assertEquals(expectedL1TranslatedQueryNValue, l1m3ForNValue.getQueryValue());
724724
Assertions.assertEquals(n_v, l1m3ForNValue.getCandidateValue());
725725

726-
// translateCorrelations a complex join condition, each quantifier in the join condition is assumed to match a corresponding
726+
// translate a complex join condition, each quantifier in the join condition is assumed to match a corresponding
727727
// quantifier in a non-joined index candidate.
728728

729729
/*
@@ -961,7 +961,7 @@ translation of (t.a.q, t.a.r, (t.b.t), t.j.s) with correlation mapping of t -> t
961961
final var l1m3ForMValue = calculate(l1TranslatedQueryMValue, m_v);
962962
final var l1m3ForNValue = calculate(l1TranslatedQueryNValue, n_v);
963963

964-
// translateCorrelations a complex join condition, each quantifier in the join condition is assumed to match a corresponding
964+
// translate a complex join condition, each quantifier in the join condition is assumed to match a corresponding
965965
// quantifier in a non-joined index candidate.
966966

967967
/*

fdb-record-layer-lucene/src/main/java/com/apple/foundationdb/record/lucene/search/BooleanPointsConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.text.NumberFormat;
2727

2828
/**
29-
* A subclass of PointsConfig to allow the Parser the ability to translateCorrelations boolean terms to binary ones.
29+
* A subclass of PointsConfig to allow the Parser the ability to translate boolean terms to binary ones.
3030
*/
3131
public class BooleanPointsConfig extends PointsConfig {
3232

fdb-relational-core/src/main/java/com/apple/foundationdb/relational/api/metrics/NoOpMetricRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* <p>
3232
* NOTE(stack): Consider NOT using codahale but prometheus metrics. If server is exporting metrics
3333
* on an prometheus endpoint, codahale will require translation (there are translators but better not
34-
* to translateCorrelations at all). What is the story for clients? RL is codahale?
34+
* to translate at all). What is the story for clients? RL is codahale?
3535
*/
3636
@API(API.Status.EXPERIMENTAL)
3737
public final class NoOpMetricRegistry {

0 commit comments

Comments
 (0)