presto-raptor-legacy/src/main/java/io/prestosql/plugin/raptor/legacy/util/PageBuffer.java/PageBuffer/flush
class PageBuffer:    public void flush()
    {
        if (pages.isEmpty()) {
            return;
        }

        if (sortFields.isEmpty()) {
            storagePageSink.appendPages(pages);
        }
        else {
            appendSorted();
        }

        storagePageSink.flush();

        pages.clear();
        rowCount = 0;
        usedMemoryBytes = 0;
    }