presto-main/src/main/java/io/prestosql/operator/RowNumberOperator.java/RowNumberOperator/isFinished
class RowNumberOperator:    @Override
    public boolean isFinished()
    {
        if (isSinglePartition() && maxRowsPerPartition.isPresent()) {
            if (finishing && !hasUnfinishedInput()) {
                return true;
            }
            return partitionRowCount.get(0) == maxRowsPerPartition.get();
        }

        return finishing && !hasUnfinishedInput();
    }