Source:
public void testOrderingColumnsArePreserved() { tester().assertThat(new PushProjectionThroughExchange()) .on(p -> { Symbol a = p.symbol("a"); Symbol b = p.symbol("b"); Symbol h = p.symbol("h"); Symbol aTimes5 = p.symbol("a_times_5"); Symbol bTimes5 = p.symbol("b_times_5"); Symbol hTimes5 = p.symbol("h_times_5"); Symbol sortSymbol = p.symbol("sortSymbol"); OrderingScheme orderingScheme = new OrderingScheme(ImmutableList.of(sortSymbol), ImmutableMap.of(sortSymbol, SortOrder.ASC_NULLS_FIRST)); return p.project( Assignments.builder() .put(aTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Type.MULTIPLY, new SymbolReference("a"), new LongLiteral("5"))) .put(bTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Type.MULTIPLY, new SymbolReference("b"), new LongLiteral("5"))) .put(hTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Type.MULTIPLY, new SymbolReference("h"), new LongLiteral("5"))) .build(), p.exchange(e -> e .addSource( p.values(a, b, h, sortSymbol)) .addInputsSet(a, b, h, sortSymbol) .singleDistributionPartitioningScheme( ImmutableList.of(a, b, h, sortSymbol)) .orderingScheme(orderingScheme))); }) .matches( project( exchange( project( values( ImmutableList.of("a", "b", "h", "sortSymbol")) ).withNumberOfOutputColumns(4) .withAlias("a_times_5", expression("a * 5")) .withAlias("b_times_5", expression("b * 5")) .withAlias("h_times_5", expression("h * 5")) .withAlias("sortSymbol", expression("sortSymbol"))) ).withNumberOfOutputColumns(3) .withExactOutputs("a_times_5", "b_times_5", "h_times_5")); }

Target:
public void testOrderingColumnsArePreserved() { tester().assertThat(new PushProjectionThroughExchange()) .on(p -> { Symbol a = p.symbol("a"); Symbol b = p.symbol("b"); Symbol h = p.symbol("h"); Symbol aTimes5 = p.symbol("a_times_5"); Symbol bTimes5 = p.symbol("b_times_5"); Symbol hTimes5 = p.symbol("h_times_5"); Symbol sortSymbol = p.symbol("sortSymbol"); OrderingScheme orderingScheme = new OrderingScheme(ImmutableList.of(sortSymbol), ImmutableMap.of(sortSymbol, SortOrder.ASC_NULLS_FIRST)); return p.project( Assignments.builder() .put(aTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Type.MULTIPLY, new SymbolReference("a"), new LongLiteral("5"))) .put(bTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Type.MULTIPLY, new SymbolReference("b"), new LongLiteral("5"))) .put(hTimes5, new ArithmeticBinaryExpression(ArithmeticBinaryExpression.Type.MULTIPLY, new SymbolReference("h"), new LongLiteral("5"))) .build(), p.exchange(e -> e .addSource( p.values(a, b, h, sortSymbol)) .addInputsSet(a, b, h, sortSymbol) .singleDistributionPartitioningScheme( ImmutableList.of(a, b, h, sortSymbol)) .orderingScheme(orderingScheme))); }) .matches( project( exchange(REMOTE, GATHER, ImmutableList.of(sort("sortSymbol", ASCENDING, FIRST)), project( values( ImmutableList.of("a", "b", "h", "sortSymbol"))) .withNumberOfOutputColumns(4) .withAlias("a_times_5", expression("a * 5")) .withAlias("b_times_5", expression("b * 5")) .withAlias("h_times_5", expression("h * 5")) .withAlias("sortSymbol", expression("sortSymbol"))) ).withNumberOfOutputColumns(3) .withExactOutputs("a_times_5", "b_times_5", "h_times_5")); }