Source:
public PhysicalOperation visitTableWriter(TableWriterNode node, LocalExecutionPlanContext context) { if (node.getPartitioningScheme().isPresent()) { context.setDriverInstanceCount(getTaskPartitionedWriterCount(session)); } else { context.setDriverInstanceCount(getTaskWriterCount(session)); } PhysicalOperation source = node.getSource().accept(this, context); ImmutableMap.Builder<VariableReferenceExpression, Integer> outputMapping = ImmutableMap.builder(); outputMapping.put(node.getRowCountVariable(), ROW_COUNT_CHANNEL); outputMapping.put(node.getFragmentVariable(), FRAGMENT_CHANNEL); outputMapping.put(node.getTableCommitContextVariable(), CONTEXT_CHANNEL); OperatorFactory statisticsAggregation = node.getStatisticsAggregation().map(aggregation -> { List<VariableReferenceExpression> groupingVariables = aggregation.getGroupingVariables(); if (groupingVariables.isEmpty()) { return createAggregationOperatorFactory( node.getId(), aggregation.getAggregations(), PARTIAL, STATS_START_CHANNEL, outputMapping, source, context, true); } return createHashAggregationOperatorFactory( node.getId(), aggregation.getAggregations(), ImmutableSet.of(), groupingVariables, PARTIAL, Optional.empty(), Optional.empty(), source, false, false, false, new DataSize(0, BYTE), context, STATS_START_CHANNEL, outputMapping, 200, Optional.empty(), true); }).orElse(new DevNullOperatorFactory(context.getNextOperatorId(), node.getId())); List<Integer> inputChannels = node.getColumns().stream() .map(source::variableToChannel) .collect(toImmutableList()); OperatorFactory operatorFactory = new TableWriterOperatorFactory( context.getNextOperatorId(), node.getId(), pageSinkManager, context.tableWriteInfo.getWriterTarget().orElseThrow(() -> new IllegalStateException("writer target is absent")), inputChannels, session, statisticsAggregation, getVariableTypes(node.getOutputVariables()), tableCommitContextCodec, stageExecutionDescriptor.isRecoverableGroupedExecution()); return new PhysicalOperation(operatorFactory, outputMapping.build(), context, source); }

Target:
public PhysicalOperation visitTableWriter(TableWriterNode node, LocalExecutionPlanContext context) { if (node.getPartitioningScheme().isPresent()) { context.setDriverInstanceCount(getTaskPartitionedWriterCount(session)); } else { context.setDriverInstanceCount(getTaskWriterCount(session)); } PhysicalOperation source = node.getSource().accept(this, context); ImmutableMap.Builder<VariableReferenceExpression, Integer> outputMapping = ImmutableMap.builder(); outputMapping.put(node.getRowCountVariable(), ROW_COUNT_CHANNEL); outputMapping.put(node.getFragmentVariable(), FRAGMENT_CHANNEL); outputMapping.put(node.getTableCommitContextVariable(), CONTEXT_CHANNEL); OperatorFactory statisticsAggregation = node.getStatisticsAggregation().map(aggregation -> { List<VariableReferenceExpression> groupingVariables = aggregation.getGroupingVariables(); if (groupingVariables.isEmpty()) { return createAggregationOperatorFactory( node.getId(), aggregation.getAggregations(), PARTIAL, STATS_START_CHANNEL, outputMapping, source, context, true); } return createHashAggregationOperatorFactory( node.getId(), aggregation.getAggregations(), ImmutableSet.of(), groupingVariables, PARTIAL, Optional.empty(), Optional.empty(), source, false, false, false, new DataSize(0, BYTE), context, STATS_START_CHANNEL, outputMapping, 200, Optional.empty(), true); }).orElse(new DevNullOperatorFactory(context.getNextOperatorId(), node.getId())); List<Integer> inputChannels = node.getColumns().stream() .map(source::variableToChannel) .collect(toImmutableList()); OperatorFactory operatorFactory = new TableWriterOperatorFactory( context.getNextOperatorId(), node.getId(), pageSinkManager, context.getTableWriteInfo().getWriterTarget().orElseThrow(() -> new VerifyException("writerTarget is absent")), inputChannels, session, statisticsAggregation, getVariableTypes(node.getOutputVariables()), tableCommitContextCodec, stageExecutionDescriptor.isRecoverableGroupedExecution()); return new PhysicalOperation(operatorFactory, outputMapping.build(), context, source); }