Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* in plan changes. See: <a href="https://github.com/FoundationDB/fdb-record-layer/issues/3998">Issue #3998</a>.
* </p>
*/
final class PickRightTiebreaker implements Tiebreaker<RelationalExpression> {
public final class PickRightTiebreaker implements Tiebreaker<RelationalExpression> {
private static final PickRightTiebreaker INSTANCE = new PickRightTiebreaker();

private PickRightTiebreaker() {
Expand All @@ -57,7 +57,7 @@ public int compare(@Nonnull final RecordQueryPlannerConfiguration configuration,
}

@Nonnull
static PickRightTiebreaker pickRightTiebreaker() {
public static PickRightTiebreaker pickRightTiebreaker() {
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -336,27 +336,27 @@ static SmallestCardinalityOfDataAccessesTiebreaker smallestCardinalityOfDataAcce
}

@Nonnull
static LowestNumUnsatisfiedFiltersTiebreaker lowestNumUnsatisfiedFiltersTiebreaker() {
public static Tiebreaker<RecordQueryPlan> lowestNumUnsatisfiedFiltersTiebreaker() {
return LowestNumUnsatisfiedFiltersTiebreaker.INSTANCE;
}

@Nonnull
static LowestNumDataAccessesTiebreaker lowestNumDataAccessesTiebreaker() {
public static Tiebreaker<RecordQueryPlan> lowestNumDataAccessesTiebreaker() {
return LowestNumDataAccessesTiebreaker.INSTANCE;
}

@Nonnull
static RecursiveCteOperatorTiebreaker recursiveCteOperatorTiebreaker() {
public static Tiebreaker<RecordQueryPlan> recursiveCteOperatorTiebreaker() {
return RecursiveCteOperatorTiebreaker.INSTANCE;
}

@Nonnull
static InOperatorTiebreaker inOperatorTiebreaker() {
public static Tiebreaker<RecordQueryPlan> inOperatorTiebreaker() {
return InOperatorTiebreaker.INSTANCE;
}

@Nonnull
static PrimaryScanVsIndexScanTiebreaker primaryScanVsIndexScanTiebreaker() {
public static Tiebreaker<RecordQueryPlan> primaryScanVsIndexScanTiebreaker() {
return PrimaryScanVsIndexScanTiebreaker.INSTANCE;
}

Expand All @@ -366,22 +366,22 @@ static VectorIndexEnginePreferenceTiebreaker vectorIndexEnginePreferenceTiebreak
}

@Nonnull
static LowestTypeFilterCountTiebreaker lowestTypeFilterCountTiebreaker() {
public static Tiebreaker<RecordQueryPlan> lowestTypeFilterCountTiebreaker() {
return LowestTypeFilterCountTiebreaker.INSTANCE;
}

@Nonnull
static DeepestTypeFilterPositionTiebreaker deepestTypeFilterPositionTiebreaker() {
public static Tiebreaker<RecordQueryPlan> deepestTypeFilterPositionTiebreaker() {
return DeepestTypeFilterPositionTiebreaker.INSTANCE;
}

@Nonnull
static BetterIndexScanTiebreaker betterIndexScanTiebreaker() {
public static Tiebreaker<RecordQueryPlan> betterIndexScanTiebreaker() {
return BetterIndexScanTiebreaker.INSTANCE;
}

@Nonnull
static DeepestDistinctTiebreaker deepestDistinctTiebreaker() {
public static Tiebreaker<RecordQueryPlan> deepestDistinctTiebreaker() {
return DeepestDistinctTiebreaker.INSTANCE;
}

Expand All @@ -391,12 +391,12 @@ static LowestNumUnmatchedFieldsTiebreaker lowestNumUnmatchedFieldsTiebreaker() {
}

@Nonnull
static HighestNumInJoinTiebreaker highestNumInJoinTiebreaker() {
public static Tiebreaker<RecordQueryPlan> highestNumInJoinTiebreaker() {
return HighestNumInJoinTiebreaker.INSTANCE;
}

@Nonnull
static LowestNumSimpleOperationsTiebreaker lowestNumSimpleOperationsTiebreaker() {
public static Tiebreaker<RecordQueryPlan> lowestNumSimpleOperationsTiebreaker() {
return LowestNumSimpleOperationsTiebreaker.INSTANCE;
}

Expand All @@ -406,12 +406,12 @@ static LowestOuterCardinalityTiebreaker lowestOuterCardinalityTiebreaker() {
}

@Nonnull
static LowestNumDefaultOnEmptyTiebreaker lowestNumDefaultOnEmptyTiebreaker() {
public static Tiebreaker<RecordQueryPlan> lowestNumDefaultOnEmptyTiebreaker() {
return LowestNumDefaultOnEmptyTiebreaker.INSTANCE;
}

@Nonnull
static PlanHashTiebreaker planHashTiebreaker() {
public static Tiebreaker<RecordQueryPlan> planHashTiebreaker() {
return PlanHashTiebreaker.INSTANCE;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
*
* @param <T> the type of expressions being compared
*/
interface Tiebreaker<T extends RelationalExpression> {
public interface Tiebreaker<T extends RelationalExpression> {

/**
* Compare two expressions. Like a {@link java.util.Comparator}, this should return a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.Optional;
import java.util.Set;

interface TiebreakerResult<T extends RelationalExpression> {
public interface TiebreakerResult<T extends RelationalExpression> {

@Nonnull
TiebreakerResult<T> thenApply(@Nonnull Tiebreaker<? super T> nextTiebreaker);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,17 @@ void inOperatorTest() {
assertCompares(inOperatorTiebreaker, inJoinSargedComparisonPlan, filterScanWithInPlan, 0);
assertCompares(inOperatorTiebreaker, inJoinSargedComparisonPlan, inJoinNonSargedPlan, 0); // anti-symmetry violation!
}

@Test
void planHashTest() {
final Tiebreaker<RecordQueryPlan> planHashTiebreaker = PlanningCostModel.planHashTiebreaker();
final RecordQueryPlan low = new RecordQueryPlanWithFixedPlanHash("low", 14);
final RecordQueryPlan high = new RecordQueryPlanWithFixedPlanHash("high", 30);
final RecordQueryPlan alsoLow = new RecordQueryPlanWithFixedPlanHash("alsoLow", 14);

assertReflexive(planHashTiebreaker, low);
assertCompares(planHashTiebreaker, low, high, -1);
assertCompares(planHashTiebreaker, high, low, 1);
assertCompares(planHashTiebreaker, low, alsoLow, 0);
}
}
Loading
Loading