Source:
<code>private <T> RddAndMore<T> createRdd(SubPlan subPlan, Class<T> outputType) { ImmutableMap.Builder<PlanFragmentId, JavaPairRDD<MutablePartitionId, PrestoSparkMutableRow>> rddInputs = ImmutableMap.builder(); ImmutableMap.Builder<PlanFragmentId, Broadcast<List<PrestoSparkSerializedPage>>> broadcastInputs = ImmutableMap.builder(); ImmutableList.Builder<Broadcast<?>> broadcastDependencies = ImmutableList.builder(); for (SubPlan child : subPlan.getChildren()) { PlanFragment childFragment = child.getFragment(); if (childFragment.getPartitioningScheme().getPartitioning().getHandle().equals(FIXED_BROADCAST_DISTRIBUTION)) { RddAndMore<PrestoSparkSerializedPage> childRdd = createRdd(child, PrestoSparkSerializedPage.class); List<PrestoSparkSerializedPage> broadcastPages = childRdd.collectAndDestroyDependencies().stream() .map(Tuple2::_2) .collect(toList()); <START> Broadcast<List<PrestoSparkSerializedPage>> broadcast = sparkContext.broadcast(broadcastPages); <END> broadcastInputs.put(childFragment.getId(), broadcast); broadcastDependencies.add(broadcast); } else { RddAndMore<PrestoSparkMutableRow> childRdd = createRdd(child, PrestoSparkMutableRow.class); rddInputs.put(childFragment.getId(), childRdd.getRdd()); broadcastDependencies.addAll(childRdd.getBroadcastDependencies()); } } JavaPairRDD<MutablePartitionId, T> rdd = rddFactory.createSparkRdd( sparkContext, session, subPlan.getFragment(), rddInputs.build(), broadcastInputs.build(), executorFactoryProvider, taskStatsCollector, tableWriteInfo, outputType); return new RddAndMore<>(rdd, broadcastDependencies.build()); }</code><technical_language>nit: toImmutableList()</technical_language>

Target:
private <T extends PrestoSparkTaskOutput> RddAndMore<T> createRdd(SubPlan subPlan, Class<T> outputType) { ImmutableMap.Builder<PlanFragmentId, JavaPairRDD<MutablePartitionId, PrestoSparkMutableRow>> rddInputs = ImmutableMap.builder(); ImmutableMap.Builder<PlanFragmentId, Broadcast<List<PrestoSparkSerializedPage>>> broadcastInputs = ImmutableMap.builder(); ImmutableList.Builder<Broadcast<?>> broadcastDependencies = ImmutableList.builder(); for (SubPlan child : subPlan.getChildren()) { PlanFragment childFragment = child.getFragment(); if (childFragment.getPartitioningScheme().getPartitioning().getHandle().equals(FIXED_BROADCAST_DISTRIBUTION)) { RddAndMore<PrestoSparkSerializedPage> childRdd = createRdd(child, PrestoSparkSerializedPage.class); List<PrestoSparkSerializedPage> broadcastPages = childRdd.collectAndDestroyDependencies().stream() .map(Tuple2::_2) .collect(toList()); Broadcast<List<PrestoSparkSerializedPage>> broadcast = sparkContext.broadcast(broadcastPages); broadcastInputs.put(childFragment.getId(), broadcast); broadcastDependencies.add(broadcast); } else { RddAndMore<PrestoSparkMutableRow> childRdd = createRdd(child, PrestoSparkMutableRow.class); rddInputs.put(childFragment.getId(), childRdd.getRdd()); broadcastDependencies.addAll(childRdd.getBroadcastDependencies()); } } JavaPairRDD<MutablePartitionId, T> rdd = rddFactory.createSparkRdd( sparkContext, session, subPlan.getFragment(), rddInputs.build(), broadcastInputs.build(), executorFactoryProvider, taskStatsCollector, tableWriteInfo, outputType); return new RddAndMore<>(rdd, broadcastDependencies.build()); }