Source:
public AggregationNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("source") PlanNode source, @JsonProperty("aggregations") Map<VariableReferenceExpression, Aggregation> aggregations, @JsonProperty("groupingSets") GroupingSetDescriptor groupingSets, @JsonProperty("preGroupedVariables") List<VariableReferenceExpression> preGroupedVariables, @JsonProperty("step") Step step, @JsonProperty("hashVariable") Optional<VariableReferenceExpression> hashVariable, @JsonProperty("groupIdVariable") Optional<VariableReferenceExpression> groupIdVariable) { super(id); this.source = source; this.aggregations = unmodifiableMap(new HashMap<>(requireNonNull(aggregations, "aggregations is null"))); requireNonNull(groupingSets, "groupingSets is null"); groupIdVariable.ifPresent(variable -> checkArgument(groupingSets.getGroupingKeys().contains(variable), "Grouping columns does not contain groupId column")); this.groupingSets = groupingSets; this.groupIdVariable = requireNonNull(groupIdVariable); boolean noOrderBy = aggregations.values().stream() .map(Aggregation::getOrderBy) .noneMatch(Optional::isPresent); checkArgument(noOrderBy || step == SINGLE, "ORDER BY does not support distributed aggregation"); this.step = step; this.hashVariable = hashVariable; requireNonNull(preGroupedVariables, "preGroupedVariables is null"); checkArgument(preGroupedVariables.isEmpty() || groupingSets.getGroupingKeys().containsAll(preGroupedVariables), "Pre-grouped variables must be a subset of the grouping keys"); this.preGroupedVariables = unmodifiableList(new ArrayList<>(preGroupedVariables)); ArrayList<VariableReferenceExpression> outputs = new ArrayList<>(groupingSets.getGroupingKeys()); hashVariable.ifPresent(outputs::add); outputs.addAll(new ArrayList<>(aggregations.keySet())); this.outputs = unmodifiableList(outputs); }

Target:
public AggregationNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("source") PlanNode source, @JsonProperty("aggregations") Map<VariableReferenceExpression, Aggregation> aggregations, @JsonProperty("groupingSets") GroupingSetDescriptor groupingSets, @JsonProperty("preGroupedVariables") List<VariableReferenceExpression> preGroupedVariables, @JsonProperty("step") Step step, @JsonProperty("hashVariable") Optional<VariableReferenceExpression> hashVariable, @JsonProperty("groupIdVariable") Optional<VariableReferenceExpression> groupIdVariable) { super(id); this.source = source; this.aggregations = unmodifiableMap(new LinkedHashMap<>(requireNonNull(aggregations, "aggregations is null"))); requireNonNull(groupingSets, "groupingSets is null"); groupIdVariable.ifPresent(variable -> checkArgument(groupingSets.getGroupingKeys().contains(variable), "Grouping columns does not contain groupId column")); this.groupingSets = groupingSets; this.groupIdVariable = requireNonNull(groupIdVariable); boolean noOrderBy = aggregations.values().stream() .map(Aggregation::getOrderBy) .noneMatch(Optional::isPresent); checkArgument(noOrderBy || step == SINGLE, "ORDER BY does not support distributed aggregation"); this.step = step; this.hashVariable = hashVariable; requireNonNull(preGroupedVariables, "preGroupedVariables is null"); checkArgument(preGroupedVariables.isEmpty() || groupingSets.getGroupingKeys().containsAll(preGroupedVariables), "Pre-grouped variables must be a subset of the grouping keys"); this.preGroupedVariables = unmodifiableList(new ArrayList<>(preGroupedVariables)); ArrayList<VariableReferenceExpression> outputs = new ArrayList<>(groupingSets.getGroupingKeys()); hashVariable.ifPresent(outputs::add); outputs.addAll(new ArrayList<>(aggregations.keySet())); this.outputs = unmodifiableList(outputs); }