Skip to content
Merged
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 @@ -148,11 +148,7 @@ protected LookupEnrichQueryGenerator queryList(
* In those cases, it is safe to ignore the plan sent and return null
*/
private static PhysicalPlan localLookupNodePlanning(PhysicalPlan physicalPlan) {
if (physicalPlan instanceof FragmentExec fragmentExec) {
LocalMapper localMapper = new LocalMapper();
return localMapper.map(fragmentExec.fragment());
}
return null;
return physicalPlan instanceof FragmentExec fragmentExec ? LocalMapper.INSTANCE.map(fragmentExec.fragment()) : null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ public static PlanReduction reductionPlan(PhysicalPlan plan) {
return SimplePlanReduction.NO_REDUCTION;
}
final LogicalPlan pipelineBreaker = pipelineBreakers.getFirst();
final LocalMapper mapper = new LocalMapper();
int estimatedRowSize = fragment.estimatedRowSize();
return switch (mapper.map(pipelineBreaker)) {
return switch (LocalMapper.INSTANCE.map(pipelineBreaker)) {
case TopNExec topN -> new TopNReduction(EstimatesRowSize.estimateRowSize(estimatedRowSize, topN));
case AggregateExec aggExec -> getPhysicalPlanReduction(estimatedRowSize, aggExec.withMode(AggregatorMode.INTERMEDIATE));
case PhysicalPlan p -> getPhysicalPlanReduction(estimatedRowSize, p);
Expand Down Expand Up @@ -218,7 +217,6 @@ public static PhysicalPlan localPlan(
LocalLogicalPlanOptimizer logicalOptimizer,
LocalPhysicalPlanOptimizer physicalOptimizer
) {
final LocalMapper localMapper = new LocalMapper();
var isCoordPlan = new Holder<>(Boolean.TRUE);
Set<PhysicalPlan> lookupJoinExecRightChildren = plan.collect(LookupJoinExec.class::isInstance)
.stream()
Expand All @@ -234,7 +232,7 @@ public static PhysicalPlan localPlan(
}
isCoordPlan.set(Boolean.FALSE);
LogicalPlan optimizedFragment = logicalOptimizer.localOptimize(f.fragment());
PhysicalPlan physicalFragment = localMapper.map(optimizedFragment);
PhysicalPlan physicalFragment = LocalMapper.INSTANCE.map(optimizedFragment);
QueryBuilder filter = f.esFilter();
if (filter != null) {
physicalFragment = physicalFragment.transformUp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
*/
public class LocalMapper {

public static LocalMapper INSTANCE = new LocalMapper();

private LocalMapper() {}

public PhysicalPlan map(LogicalPlan p) {

if (p instanceof LeafPlan leaf) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static Optional<ReductionPlan> planReduceDriverTopN(
}

private static PhysicalPlan toPhysical(LogicalPlan plan, LocalPhysicalOptimizerContext context) {
return new InsertFieldExtraction().apply(new ReplaceSourceAttributes().apply(new LocalMapper().map(plan)), context);
return new InsertFieldExtraction().apply(new ReplaceSourceAttributes().apply(LocalMapper.INSTANCE.map(plan)), context);
}

private LateMaterializationPlanner() { /* static class */ }
Expand Down