presto-spi/src/main/java/io/prestosql/spi/block/SortOrder.java/SortOrder/compareBlockValue
class SortOrder:    public int compareBlockValue(Type type, Block leftBlock, int leftPosition, Block rightBlock, int rightPosition)
    {
        boolean leftIsNull = leftBlock.isNull(leftPosition);
        boolean rightIsNull = rightBlock.isNull(rightPosition);

        if (leftIsNull && rightIsNull) {
            return 0;
        }
        if (leftIsNull) {
            return nullsFirst ? -1 : 1;
        }
        if (rightIsNull) {
            return nullsFirst ? 1 : -1;
        }

        int result = type.compareTo(leftBlock, leftPosition, rightBlock, rightPosition);
        return ascending ? result : -result;
    }