class SortedPagingIteratorBenchmark {

    private Comparator<Row> compareOnFirstColumn;
    private Random rnd;
    private List<Row> unsortedSecond;
    private List<Row> unsortedFirst;
    private List<Row> sortedFirst;
    private List<Row> sortedSecond;

    @Setup
    public void prepareData() {
        rnd = new Random(42);
        compareOnFirstColumn = OrderingByPosition.rowOrdering(DataTypes.INTEGER, 0, false, false);

        unsortedFirst = IntStream.range(0, 1_000_000).mapToObj(Row1::new).collect(Collectors.toList());
        unsortedSecond = IntStream.range(500_000, 1_500_00).mapToObj(Row1::new).collect(Collectors.toList());
        Collections.shuffle(unsortedFirst, rnd);
        Collections.shuffle(unsortedSecond, rnd);

        sortedFirst = new ArrayList<>(unsortedFirst);
        sortedFirst.sort(compareOnFirstColumn);

        sortedSecond = new ArrayList<>(unsortedSecond);
        sortedSecond.sort(compareOnFirstColumn);
    }

    @Benchmark
    public void measurePagingIteratorWithRepeat(Blackhole blackhole) {
        PagingIterator<Integer, Row> pagingIterator = PagingIterator.createSorted(compareOnFirstColumn, true);
        pagingIterator.merge(Arrays.asList(new KeyIterable<>(1, sortedFirst), new KeyIterable<>(2, sortedSecond)));
        pagingIterator.finish();

        while (pagingIterator.hasNext()) {
            blackhole.consume(pagingIterator.next());
        }
    }

    @Benchmark
    public void measurePagingIteratorWithoutRepeat(Blackhole blackhole) {<FILL_FUNCTION_BODY>}

    @Benchmark
    public void measurePagingIteratorWithSort(Blackhole blackhole) throws Exception {
        unsortedFirst.sort(compareOnFirstColumn);
        unsortedSecond.sort(compareOnFirstColumn);

        PagingIterator<Integer, Row> pagingIterator = PagingIterator.createSorted(compareOnFirstColumn, false);
        pagingIterator.merge(Arrays.asList(new KeyIterable<>(1, sortedFirst), new KeyIterable<>(2, sortedSecond)));
        pagingIterator.finish();

        while (pagingIterator.hasNext()) {
            blackhole.consume(pagingIterator.next());
        }
        Collections.shuffle(unsortedFirst, rnd);
        Collections.shuffle(unsortedSecond, rnd);
    }


    @Benchmark
    public void measureListSort(Blackhole blackhole) {
        ArrayList<Row> allRows = new ArrayList<>(unsortedFirst);
        allRows.addAll(unsortedSecond);
        allRows.sort(compareOnFirstColumn);
        for (Row row : allRows) {
            blackhole.consume(row);
        }
        // reset to avoid sorting a already sorted list in the next iteration
        Collections.shuffle(unsortedFirst, rnd);
        Collections.shuffle(unsortedSecond, rnd);
    }
}

        PagingIterator<Integer, Row> pagingIterator = PagingIterator.createSorted(compareOnFirstColumn, false);
        pagingIterator.merge(Arrays.asList(new KeyIterable<>(1, sortedFirst), new KeyIterable<>(2, sortedSecond)));
        pagingIterator.finish();

        while (pagingIterator.hasNext()) {
            blackhole.consume(pagingIterator.next());
        }
    
<no_super_class>