Source:
<code>public PlanWithProperties visitTableWriter(TableWriterNode originalTableWriterNode, StreamPreferredProperties parentPreferences) { if (getTaskWriterCount(session) == 1) { return planAndEnforceChildren(originalTableWriterNode, singleStream(), defaultParallelism(session)); } if (!isTableWriterMergeOperatorEnabled(session)) { return planAndEnforceChildren(originalTableWriterNode, fixedParallelism(), fixedParallelism()); } <START> Optional<StatisticAggregations.Parts> statisticAggregations = originalTableWriterNode.getStatisticsAggregation() <END> .map(aggregations -> aggregations.splitIntoPartialAndIntermediate(variableAllocator, metadata.getFunctionManager())); PlanWithProperties tableWriter = planAndEnforceChildren( new TableWriterNode( originalTableWriterNode.getId(), originalTableWriterNode.getSource(), originalTableWriterNode.getTarget(), variableAllocator.newVariable("partialrowcount", BIGINT), variableAllocator.newVariable("partialfragments", VARBINARY), variableAllocator.newVariable("partialcontext", VARBINARY), originalTableWriterNode.getColumns(), originalTableWriterNode.getColumnNames(), originalTableWriterNode.getPartitioningScheme(), statisticAggregations.map(StatisticAggregations.Parts::getPartialAggregation)), fixedParallelism(), fixedParallelism()); PlanWithProperties gatheringExchange = deriveProperties( gatheringExchange( idAllocator.getNextId(), LOCAL, tableWriter.getNode()), tableWriter.getProperties()); return deriveProperties( new TableWriterMergeNode( idAllocator.getNextId(), gatheringExchange.getNode(), originalTableWriterNode.getRowCountVariable(), originalTableWriterNode.getFragmentVariable(), originalTableWriterNode.getTableCommitContextVariable(), statisticAggregations.map(StatisticAggregations.Parts::getFinalOrIntermediateAggregation)), gatheringExchange.getProperties()); }</code><technical_language>nit: split more lines? java Optional<StatisticAggregations.Parts> statisticAggregations = originalTableWriterNode .getStatisticsAggregation() .map(aggregations -> aggregations.splitIntoPartialAndIntermediate( variableAllocator, metadata.getFunctionManager())); personal preference. strong opinion</technical_language>

Target:
public PlanWithProperties visitTableWriter(TableWriterNode originalTableWriterNode, StreamPreferredProperties parentPreferences) { if (getTaskWriterCount(session) == 1) { return planAndEnforceChildren(originalTableWriterNode, singleStream(), defaultParallelism(session)); } if (!isTableWriterMergeOperatorEnabled(session)) { return planAndEnforceChildren(originalTableWriterNode, fixedParallelism(), fixedParallelism()); } Optional<StatisticAggregations.Parts> statisticAggregations = originalTableWriterNode .getStatisticsAggregation() .map(aggregations -> aggregations.splitIntoPartialAndIntermediate( variableAllocator, metadata.getFunctionManager())); PlanWithProperties tableWriter = planAndEnforceChildren( new TableWriterNode( originalTableWriterNode.getId(), originalTableWriterNode.getSource(), originalTableWriterNode.getTarget(), variableAllocator.newVariable("partialrowcount", BIGINT), variableAllocator.newVariable("partialfragments", VARBINARY), variableAllocator.newVariable("partialcontext", VARBINARY), originalTableWriterNode.getColumns(), originalTableWriterNode.getColumnNames(), originalTableWriterNode.getPartitioningScheme(), statisticAggregations.map(StatisticAggregations.Parts::getPartialAggregation)), fixedParallelism(), fixedParallelism()); PlanWithProperties gatheringExchange = deriveProperties( gatheringExchange( idAllocator.getNextId(), LOCAL, tableWriter.getNode()), tableWriter.getProperties()); return deriveProperties( new TableWriterMergeNode( idAllocator.getNextId(), gatheringExchange.getNode(), originalTableWriterNode.getRowCountVariable(), originalTableWriterNode.getFragmentVariable(), originalTableWriterNode.getTableCommitContextVariable(), statisticAggregations.map(StatisticAggregations.Parts::getIntermediateAggregation)), gatheringExchange.getProperties()); }