presto-hive/src/main/java/io/prestosql/plugin/hive/util/SortBuffer.java/SortBuffer/canAdd
class SortBuffer:    public boolean canAdd(Page page)
    {
        return (usedMemoryBytes < maxMemoryBytes) &&
                ((((long) rowCount) + page.getPositionCount()) <= Integer.MAX_VALUE);
    }