Skip to content

Commit 4696111

Browse files
committed
Replace mapDebugger in StatsDebugger with flatMapDebugger
The only method that has a return value in the StatsDebugger interface returns an Optional, so this makes more sense.
1 parent 6bacc1e commit 4696111

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public QueryPlanResult planQuery(@Nonnull final RecordQuery query,
332332
.put(QueryPlanInfoKeys.MAX_TASK_QUEUE_SIZE, maxQueueSize)
333333
.put(QueryPlanInfoKeys.CONSTRAINTS, constraints)
334334
.put(QueryPlanInfoKeys.STATS_MAPS,
335-
StatsDebugger.getDebuggerMaybe().flatMap(StatsDebugger::getStatsMaps)
335+
StatsDebugger.flatMapDebugger(StatsDebugger::getStatsMaps)
336336
.orElse(null))
337337
.build();
338338
return new QueryPlanResult(plan, info);
@@ -376,7 +376,7 @@ public QueryPlanResult planGraph(@Nonnull final Supplier<Reference> referenceSup
376376
QueryPlanInfo.newBuilder()
377377
.put(QueryPlanInfoKeys.CONSTRAINTS, constraints)
378378
.put(QueryPlanInfoKeys.STATS_MAPS,
379-
StatsDebugger.getDebuggerMaybe().flatMap(StatsDebugger::getStatsMaps)
379+
StatsDebugger.flatMapDebugger(StatsDebugger::getStatsMaps)
380380
.orElse(null))
381381
.build());
382382
} finally {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ static void withDebugger(@Nonnull final Consumer<StatsDebugger> action) {
5050
}
5151

5252
@Nonnull
53-
static <T> Optional<T> mapDebugger(@Nonnull final Function<StatsDebugger, T> function) {
54-
return getDebuggerMaybe().map(function);
53+
static <T> Optional<T> flatMapDebugger(@Nonnull final Function<StatsDebugger, Optional<T>> function) {
54+
return getDebuggerMaybe().flatMap(function);
5555
}
5656

5757
@Nonnull

0 commit comments

Comments
 (0)