Source:
<code>public void testDoesNotCreateJoinWhenPartitionedOnCrossJoin() { PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator(); PlanBuilder planBuilder = new PlanBuilder(idAllocator, queryRunner.getMetadata()); Symbol a1 = planBuilder.symbol("A1", BIGINT); Symbol b1 = planBuilder.symbol("B1", BIGINT); MultiJoinNode multiJoinNode = new MultiJoinNode( new LinkedHashSet<>(ImmutableList.of(planBuilder.values(a1), planBuilder.values(b1))), TRUE_LITERAL, ImmutableList.of(a1, b1)); SymbolAllocator symbolAllocator = new SymbolAllocator(); <START> CachingStatsProvider statsProvider = new CachingStatsProvider( <END> queryRunner.getStatsCalculator(), Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); CachingCostProvider costProvider = new CachingCostProvider( queryRunner.getCostCalculator(), statsProvider, Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); ReorderJoins.JoinEnumerator joinEnumerator = new ReorderJoins.JoinEnumerator( queryRunner.getDefaultSession(), costProvider, new CostComparator(1, 1, 1), idAllocator, multiJoinNode.getFilter(), noLookup()); JoinEnumerationResult actual = joinEnumerator.createJoinAccordingToPartitioning(multiJoinNode.getSources(), multiJoinNode.getOutputSymbols(), ImmutableSet.of(0)); assertFalse(actual.getPlanNode().isPresent()); }</code><technical_language>is hard understand logic boiler plate; consider renaming planBuilder p, MultiJoinNodeBuilder extracting a helper method build a cost provider: ReorderJoins.JoinEnumerator joinEnumerator = new ReorderJoins.JoinEnumerator( queryRunner.getDefaultSession(), costProvider(), new CostComparator(1, 1, 1), idAllocator, multiJoinNode.getFilter(), noLookup()); private CachingCostProvider costProvider() { SymbolAllocator symbolAllocator = new SymbolAllocator(); CachingStatsProvider statsProvider = new CachingStatsProvider( queryRunner.getStatsCalculator(), Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); return new CachingCostProvider( queryRunner.getCostCalculator(), statsProvider, Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); }</technical_language>

Target:
public void testDoesNotCreateJoinWhenPartitionedOnCrossJoin() { PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator(); PlanBuilder planBuilder = new PlanBuilder(idAllocator, queryRunner.getMetadata()); Symbol a1 = planBuilder.symbol("A1", BIGINT); Symbol b1 = planBuilder.symbol("B1", BIGINT); MultiJoinNode multiJoinNode = new MultiJoinNode( new LinkedHashSet<>(ImmutableList.of(planBuilder.values(a1), planBuilder.values(b1))), TRUE_LITERAL, ImmutableList.of(a1, b1)); SymbolAllocator symbolAllocator = new SymbolAllocator(); CachingStatsProvider statsProvider = new CachingStatsProvider( queryRunner.getStatsCalculator(), Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); CachingCostProvider costProvider = new CachingCostProvider( queryRunner.getCostCalculator(), statsProvider, Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); ReorderJoins.JoinEnumerator joinEnumerator = new ReorderJoins.JoinEnumerator( queryRunner.getDefaultSession(), costProvider, new CostComparator(1, 1, 1), idAllocator, multiJoinNode.getFilter(), noLookup(), new Rule.Context() { @Override public Lookup getLookup() { return null; } @Override public PlanNodeIdAllocator getIdAllocator() { return null; } @Override public SymbolAllocator getSymbolAllocator() { return null; } @Override public Session getSession() { return null; } @Override public StatsProvider getStatsProvider() { return null; } @Override public CostProvider getCostProvider() { return null; } @Override public void checkTimeoutNotExhausted() }); JoinEnumerationResult actual = joinEnumerator.createJoinAccordingToPartitioning(multiJoinNode.getSources(), multiJoinNode.getOutputSymbols(), ImmutableSet.of(0)); assertFalse(actual.getPlanNode().isPresent()); }