presto-main/src/main/java/io/prestosql/operator/TopNOperator.java/TopNOperator/process
class TopNOperator:        @Override
        public TransformationState<Page> process(Page inputPage)
        {
            if (inputPage != null) {
                addPage(inputPage);
                return TransformationState.needsMoreData();
            }

            // no more input, return results
            Page page = null;
            while (page == null && !topNProcessor.noMoreOutput()) {
                page = topNProcessor.getOutput();
            }

            if (page != null) {
                return TransformationState.ofResult(page, false);
            }

            return TransformationState.finished();
        }