presto-main/src/main/java/io/prestosql/operator/RowNumberOperator.java/RowNumberOperator/needsInput
class RowNumberOperator:    @Override
    public boolean needsInput()
    {
        if (isSinglePartition() && maxRowsPerPartition.isPresent()) {
            // Check if single partition is done
            return partitionRowCount.get(0) < maxRowsPerPartition.get() && !finishing && !hasUnfinishedInput();
        }
        return !finishing && !hasUnfinishedInput();
    }