@Override
    public long asLong() {
        if (isNullOrEmpty()) {
            return 0;
        }

        ClickHouseBitmap v = getValue();
        if (v.getCardinality() != 1) {
            throw new IllegalArgumentException(
                    ClickHouseUtils.format("Expect only one element but we got %d", v.getLongCardinality()));
        }
        return v.innerType.getByteLength() > 4 ? v.toLongArray()[0] : v.toIntArray()[0];
    }
Update value of the given object or create a new instance if {@code ref} is
null.

@param ref   object to update, could be null
@param value value
@return same object as {@code ref} or a new instance if it's null
clickhouse-data/src/main/java/com/clickhouse/data/value/ClickHouseBitmapValue.java