presto-main/src/main/java/io/prestosql/operator/TopNRowNumberOperator.java/TopNRowNumberOperator/needsInput
class TopNRowNumberOperator:    @Override
    public boolean needsInput()
    {
        // still has more input, has not started flushing yet, and has no unfinished work
        return !finishing && outputIterator == null && unfinishedWork == null;
    }