@Override
    @SuppressWarnings("unchecked")
    public <K, V> Map<K, V> asMap(Class<K> keyClass, Class<V> valueClass) {
        if (!keyType.isAssignableFrom(keyClass) || !valueType.isAssignableFrom(valueClass)) {
            throw new IllegalArgumentException(
                    String.format(Locale.ROOT, "Incompatible types, expected (%s:%s) but got (%s:%s)",
                            keyType.getName(), valueType.getName(), keyClass, valueClass));
        }

        return (Map<K, V>) getValue();
    }
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
@param keyType   non-null class of key
@param valueType non-null class of value
@return same object as {@code ref} or a new instance if it's null
clickhouse-data/src/main/java/com/clickhouse/data/value/ClickHouseMapValue.java