Skip to content

Commit dd18b65

Browse files
committed
some polishing
1 parent 99f2c43 commit dd18b65

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
@@ -44,7 +44,6 @@
4444
import com.apple.foundationdb.record.query.plan.cascades.values.RecordConstructorValue;
4545
import com.apple.foundationdb.record.query.plan.cascades.values.Value;
4646
import com.apple.foundationdb.record.query.plan.cascades.values.Values;
47-
import com.apple.foundationdb.record.query.plan.cascades.values.translation.TranslationMap;
4847
import com.apple.foundationdb.record.util.pair.NonnullPair;
4948
import com.google.common.base.Preconditions;
5049
import com.google.common.base.Suppliers;
@@ -162,8 +161,7 @@ public MatchCandidate expand(@Nonnull final Supplier<Quantifier.ForEach> baseQua
162161
recordTypes,
163162
baseQuantifier.getFlowedObjectType(),
164163
groupByQun.getRangesOver().get().getResultValue(),
165-
selectHaving,
166-
constructSelectHavingResult.getGroupByValues());
164+
selectHaving);
167165
}
168166

169167
@Nonnull
@@ -334,12 +332,8 @@ private ConstructSelectHavingResult constructSelectHaving(@Nonnull final Quantif
334332
finalPlaceholders = placeholderAliases.build();
335333
}
336334

337-
final var currentGroupingValues = groupingValues.stream()
338-
.map(groupingValue -> groupingValue.translateCorrelations(TranslationMap.ofAliases(groupByQun.getAlias(), Quantifier.current())))
339-
.collect(ImmutableList.toImmutableList());
340-
341335
return new ConstructSelectHavingResult(selectHavingGraphExpansionBuilder.build().buildSelect(),
342-
finalPlaceholders, currentGroupingValues);
336+
finalPlaceholders);
343337
}
344338

345339
@Nonnull
@@ -390,15 +384,11 @@ private static class ConstructSelectHavingResult {
390384
private final SelectExpression selectExpression;
391385
@Nonnull
392386
private final List<CorrelationIdentifier> placeholderAliases;
393-
@Nonnull
394-
private final List<Value> groupByValues;
395387

396388
private ConstructSelectHavingResult(@Nonnull final SelectExpression selectExpression,
397-
@Nonnull final List<CorrelationIdentifier> placeholderAliases,
398-
@Nonnull final List<Value> groupByValues) {
389+
@Nonnull final List<CorrelationIdentifier> placeholderAliases) {
399390
this.selectExpression = selectExpression;
400391
this.placeholderAliases = placeholderAliases;
401-
this.groupByValues = groupByValues;
402392
}
403393

404394
@Nonnull
@@ -410,10 +400,5 @@ public SelectExpression getSelectExpression() {
410400
public List<CorrelationIdentifier> getPlaceholderAliases() {
411401
return placeholderAliases;
412402
}
413-
414-
@Nonnull
415-
public List<Value> getGroupByValues() {
416-
return groupByValues;
417-
}
418403
}
419404
}

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
@@ -99,9 +99,6 @@ public class AggregateIndexMatchCandidate implements MatchCandidate, WithBaseQua
9999
@Nonnull
100100
private final SelectExpression selectHavingExpression;
101101

102-
@Nonnull
103-
private final List<Value> groupByValues;
104-
105102
/**
106103
* Creates a new instance of {@link AggregateIndexMatchCandidate}.
107104
*
@@ -119,8 +116,7 @@ public AggregateIndexMatchCandidate(@Nonnull final Index index,
119116
@Nonnull final Collection<RecordType> recordTypes,
120117
@Nonnull final Type baseType,
121118
@Nonnull final Value groupByResultValue,
122-
@Nonnull final SelectExpression selectHavingExpression,
123-
@Nonnull final List<Value> groupByValues) {
119+
@Nonnull final SelectExpression selectHavingExpression) {
124120
Preconditions.checkArgument(!recordTypes.isEmpty());
125121
this.index = index;
126122
this.traversal = traversal;
@@ -129,7 +125,6 @@ public AggregateIndexMatchCandidate(@Nonnull final Index index,
129125
this.baseType = baseType;
130126
this.groupByResultValue = groupByResultValue;
131127
this.selectHavingExpression = selectHavingExpression;
132-
this.groupByValues = ImmutableList.copyOf(groupByValues);
133128
}
134129

135130
@Nonnull
@@ -156,16 +151,6 @@ public List<CorrelationIdentifier> getOrderingAliases() {
156151
return sargableAndOrderAliases;
157152
}
158153

159-
@Nonnull
160-
public SelectExpression getSelectHavingExpression() {
161-
return selectHavingExpression;
162-
}
163-
164-
@Nonnull
165-
public List<Value> getGroupByValues() {
166-
return groupByValues;
167-
}
168-
169154
@Nonnull
170155
@Override
171156
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 ImmutableSetMultimap<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);
@@ -398,7 +398,7 @@ public boolean isImpossible() {
398398
public ResultCompensationFunction amend(@Nonnull final BiMap<CorrelationIdentifier, Value> unmatchedAggregateMap,
399399
@Nonnull final Map<Value, Value> amendedMatchedAggregateMap) {
400400
final var amendedTranslatedQueryValue =
401-
amendValue(unmatchedAggregateMap, amendedMatchedAggregateMap, value);
401+
replaceNewlyMatchedValues(unmatchedAggregateMap, amendedMatchedAggregateMap, value);
402402
return ofValue(amendedTranslatedQueryValue, true);
403403
}
404404

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
@@ -722,7 +722,7 @@ translation of (t.a.q, t.a.r, (t.b.t), t.j.s) with correlation mapping of t -> t
722722
Assertions.assertEquals(expectedL1TranslatedQueryNValue, l1m3ForNValue.getQueryValue());
723723
Assertions.assertEquals(n_v, l1m3ForNValue.getCandidateValue());
724724

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

728728
/*
@@ -952,7 +952,7 @@ translation of (t.a.q, t.a.r, (t.b.t), t.j.s) with correlation mapping of t -> t
952952
final var l1m3ForMValue = calculate(l1TranslatedQueryMValue, m_v);
953953
final var l1m3ForNValue = calculate(l1TranslatedQueryNValue, n_v);
954954

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

958958
/*

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)