Source:
<code>public ExchangeNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("type") Type type, @JsonProperty("scope") Scope scope, @JsonProperty("partitioningScheme") PartitioningScheme partitioningScheme, @JsonProperty("sources") List<PlanNode> sources, @JsonProperty("inputs") List<List<Symbol>> inputs, @JsonProperty("orderingScheme") Optional<OrderingScheme> orderingScheme) { super(id); requireNonNull(type, "type is null"); requireNonNull(scope, "scope is null"); requireNonNull(sources, "sources is null"); requireNonNull(partitioningScheme, "partitioningScheme is null"); requireNonNull(inputs, "inputs is null"); requireNonNull(orderingScheme, "orderingScheme is null"); checkArgument(!inputs.isEmpty(), "inputs is empty"); checkArgument(inputs.stream().allMatch(inputSymbols -> inputSymbols.size() == partitioningScheme.getOutputLayout().size()), "Input symbols do not match output symbols"); checkArgument(inputs.size() == sources.size(), "Must have same number of input lists as sources"); for (int i = 0; i < inputs.size(); i++) { checkArgument(sources.get(i).getOutputSymbols().containsAll(inputs.get(i)), "Source does not supply all required input symbols"); } checkArgument(scope != LOCAL || partitioningScheme.getPartitioning().getArguments().stream().allMatch(ArgumentBinding::isVariable), "local exchanges do not support constant partition function arguments"); checkArgument(scope != REMOTE || type == Type.REPARTITION || !partitioningScheme.isReplicateNullsAndAny(), "Only REPARTITION can replicate remotely"); PartitioningHandle partitioningHandle = partitioningScheme.getPartitioning().getHandle(); checkArgument(!orderingScheme.isPresent() || scope != REMOTE || partitioningHandle.equals(SINGLE_DISTRIBUTION), <START> "remote merging exchange requires single distribution"); <END> orderingScheme.ifPresent(ordering -> sources.forEach(source -> checkArgument(source.getOutputSymbols().containsAll(ordering.getOrderBy()), "Source does not supply all required ordering symbols"))); this.type = type; this.sources = sources; this.scope = scope; this.partitioningScheme = partitioningScheme; this.inputs = listOfListsCopy(inputs); this.orderingScheme = orderingScheme; }</code><technical_language>move check: ordering.scheme.ifPresent(ordering -> checkArgument(scope != REMOTE || ...)</technical_language>

Target:
public ExchangeNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("type") Type type, @JsonProperty("scope") Scope scope, @JsonProperty("partitioningScheme") PartitioningScheme partitioningScheme, @JsonProperty("sources") List<PlanNode> sources, @JsonProperty("inputs") List<List<Symbol>> inputs, @JsonProperty("orderingScheme") Optional<OrderingScheme> orderingScheme) { super(id); requireNonNull(type, "type is null"); requireNonNull(scope, "scope is null"); requireNonNull(sources, "sources is null"); requireNonNull(partitioningScheme, "partitioningScheme is null"); requireNonNull(inputs, "inputs is null"); requireNonNull(orderingScheme, "orderingScheme is null"); checkArgument(!inputs.isEmpty(), "inputs is empty"); checkArgument(inputs.stream().allMatch(inputSymbols -> inputSymbols.size() == partitioningScheme.getOutputLayout().size()), "Input symbols do not match output symbols"); checkArgument(inputs.size() == sources.size(), "Must have same number of input lists as sources"); for (int i = 0; i < inputs.size(); i++) { checkArgument(sources.get(i).getOutputSymbols().containsAll(inputs.get(i)), "Source does not supply all required input symbols"); } checkArgument(scope != LOCAL || partitioningScheme.getPartitioning().getArguments().stream().allMatch(ArgumentBinding::isVariable), "local exchanges do not support constant partition function arguments"); checkArgument(scope != REMOTE || type == Type.REPARTITION || !partitioningScheme.isReplicateNullsAndAny(), "Only REPARTITION can replicate remotely"); orderingScheme.ifPresent(ordering -> { PartitioningHandle partitioningHandle = partitioningScheme.getPartitioning().getHandle(); checkArgument(scope != REMOTE || partitioningHandle.equals(SINGLE_DISTRIBUTION), "remote merging exchange requires single distribution"); checkArgument(scope != LOCAL || partitioningHandle.equals(FIXED_PASSTHROUGH_DISTRIBUTION), "local merging exchange requires passthrough distribution"); sources.forEach(source -> checkArgument(source.getOutputSymbols().containsAll(ordering.getOrderBy()), "Source does not supply all required ordering symbols")); }); this.type = type; this.sources = sources; this.scope = scope; this.partitioningScheme = partitioningScheme; this.inputs = listOfListsCopy(inputs); this.orderingScheme = orderingScheme; }