public TopNOperator( OperatorContext operatorContext, List<Type> types, int n, List<Integer> sortChannels, List<SortOrder> sortOrders) { this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.localUserMemoryContext = operatorContext.localUserMemoryContext(); checkArgument(n >= 0, "n must be positive"); if (n == 0) { finishing = true; outputIterator = emptyIterator(); } else { topNBuilder = new GroupedTopNBuilder( types, new SimplePageWithPositionComparator(types, sortChannels, sortOrders), n, false, new NoChannelGroupByHash()); } }
@Test public void testEmptyInput() { GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( ImmutableList.of(BIGINT), (left, leftPosition, right, rightPosition) -> { throw new UnsupportedOperationException(); }, 5, false, new NoChannelGroupByHash()); assertFalse(groupedTopNBuilder.buildResult().hasNext()); }
this.groupedTopNBuilder = new GroupedTopNBuilder( ImmutableList.copyOf(sourceTypes), new SimplePageWithPositionComparator(types, sortChannels, sortOrders),
@Setup public void setup() { page = createInputPage(Integer.valueOf(positions), types); topNBuilder = new GroupedTopNBuilder(types, comparator, Integer.valueOf(topN), false, new NoChannelGroupByHash()); }
GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( types, new SimplePageWithPositionComparator(types, ImmutableList.of(1), ImmutableList.of(ASC_NULLS_LAST)),
GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( types, new SimplePageWithPositionComparator(types, ImmutableList.of(1), ImmutableList.of(ASC_NULLS_LAST)),
GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( types, new SimplePageWithPositionComparator(types, ImmutableList.of(1), ImmutableList.of(ASC_NULLS_LAST)),
.build(); GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( types, new SimplePageWithPositionComparator(types, ImmutableList.of(1), ImmutableList.of(ASC_NULLS_LAST)),
GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( types, new SimplePageWithPositionComparator(types, ImmutableList.of(1), ImmutableList.of(ASC_NULLS_LAST)),