@Test public void testPickLayoutPartitionedOnMultiple() throws Exception { Comparator<ActualProperties> preference = streamingExecutionPreference( PreferredProperties.partitioned(ImmutableSet.of(symbol("a"), symbol("b")))); List<ActualProperties> input = ImmutableList.<ActualProperties>builder() .add(builder().global(streamPartitionedOn("a")).build()) .add(builder().global(singleStreamPartition()).build()) .add( builder() .global(arbitraryPartition()) .local(ImmutableList.of(grouped("a", "b"))) .build()) .add(builder().global(arbitraryPartition()).build()) .add(builder().global(hashDistributedOn("a")).build()) .add( builder() .global(singleStream()) .local(ImmutableList.of(constant("a"), sorted("b", ASC_NULLS_FIRST))) .build()) .add( builder() .global(singleStreamPartition()) .local(ImmutableList.of(sorted("a", ASC_NULLS_FIRST))) .build()) .add(builder().global(hashDistributedOn("a")).build()) .build(); List<ActualProperties> expected = ImmutableList.<ActualProperties>builder() .add(builder().global(streamPartitionedOn("a")).build()) .add(builder().global(singleStreamPartition()).build()) .add(builder().global(hashDistributedOn("a")).build()) .add( builder() .global(singleStream()) .local(ImmutableList.of(constant("a"), sorted("b", ASC_NULLS_FIRST))) .build()) .add( builder() .global(singleStreamPartition()) .local(ImmutableList.of(sorted("a", ASC_NULLS_FIRST))) .build()) .add(builder().global(hashDistributedOn("a")).build()) .add( builder() .global(arbitraryPartition()) .local(ImmutableList.of(grouped("a", "b"))) .build()) .add(builder().global(arbitraryPartition()).build()) .build(); Assert.assertEquals(stableSort(input, preference), expected); }