presto-raptor-legacy/src/main/java/io/prestosql/plugin/raptor/legacy/util/PageBuffer.java/PageBuffer/flushIfNecessary
class PageBuffer:    private void flushIfNecessary(int rowsToAdd)
    {
        if (storagePageSink.isFull() || !canAddRows(rowsToAdd)) {
            flush();
        }
    }