Source:
<code>public PhysicalOperation visitTopNRowNumber(TopNRowNumberNode node, LocalExecutionPlanContext context) { PhysicalOperation source = node.getSource().accept(this, context); List<Symbol> partitionBySymbols = node.getPartitionBy(); List<Integer> partitionChannels = getChannelsForSymbols(partitionBySymbols, source.getLayout()); List<Type> partitionTypes = partitionChannels.stream() .map(channel -> source.getTypes().get(channel)) .collect(toImmutableList()); <START> List<Symbol> orderBySymbols = node.getOrderingScheme().getOrderBy(); <END> List<Integer> sortChannels = getChannelsForSymbols(orderBySymbols, source.getLayout()); List<SortOrder> sortOrder = orderBySymbols.stream() .map(symbol -> node.getOrderingScheme().getOrderings().get(symbol)) .collect(toImmutableList()); ImmutableList.Builder<Integer> outputChannels = ImmutableList.builder(); for (int i = 0; i < source.getTypes().size(); i++) { outputChannels.add(i); } ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder(); outputMappings.putAll(source.getLayout()); if (!node.isPartial() || !partitionChannels.isEmpty()) { int channel = source.getTypes().size(); outputMappings.put(node.getRowNumberSymbol(), channel); } Optional<Integer> hashChannel = node.getHashSymbol().map(channelGetter(source)); OperatorFactory operatorFactory = new TopNRowNumberOperator.TopNRowNumberOperatorFactory( context.getNextOperatorId(), node.getId(), source.getTypes(), outputChannels.build(), partitionChannels, partitionTypes, sortChannels, sortOrder, node.getMaxRowCountPerPartition(), node.isPartial(), hashChannel, 1000, joinCompiler); return new PhysicalOperation(operatorFactory, makeLayout(node), source); }</code><technical_language>this belongs commit</technical_language>

Target:
public PhysicalOperation visitTopNRowNumber(TopNRowNumberNode node, LocalExecutionPlanContext context) { PhysicalOperation source = node.getSource().accept(this, context); List<Symbol> partitionBySymbols = node.getPartitionBy(); List<Integer> partitionChannels = getChannelsForSymbols(partitionBySymbols, source.getLayout()); List<Type> partitionTypes = partitionChannels.stream() .map(channel -> source.getTypes().get(channel)) .collect(toImmutableList()); List<Symbol> orderBySymbols = node.getOrderingScheme().getOrderBy(); List<Integer> sortChannels = getChannelsForSymbols(orderBySymbols, source.getLayout()); List<SortOrder> sortOrder = orderBySymbols.stream() .map(symbol -> node.getOrderingScheme().getOrdering(symbol)) .collect(toImmutableList()); ImmutableList.Builder<Integer> outputChannels = ImmutableList.builder(); for (int i = 0; i < source.getTypes().size(); i++) { outputChannels.add(i); } ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder(); outputMappings.putAll(source.getLayout()); if (!node.isPartial() || !partitionChannels.isEmpty()) { int channel = source.getTypes().size(); outputMappings.put(node.getRowNumberSymbol(), channel); } Optional<Integer> hashChannel = node.getHashSymbol().map(channelGetter(source)); OperatorFactory operatorFactory = new TopNRowNumberOperator.TopNRowNumberOperatorFactory( context.getNextOperatorId(), node.getId(), source.getTypes(), outputChannels.build(), partitionChannels, partitionTypes, sortChannels, sortOrder, node.getMaxRowCountPerPartition(), node.isPartial(), hashChannel, 1000, joinCompiler); return new PhysicalOperation(operatorFactory, makeLayout(node), source); }