clickhouse.rs icon indicating copy to clipboard operation
clickhouse.rs copied to clipboard

Support Dynamic data type

Open slvrtrn opened this issue 1 year ago • 1 comments

https://clickhouse.com/docs/en/sql-reference/data-types/dynamic

slvrtrn avatar Sep 05 '24 13:09 slvrtrn

According to docs this is encoded as

<binary_encoded_data_type><value_in_binary_format_according_to_the_data_type>

So, it should lead to deserialize_any (to ask for the real type from the deserializer).

Then, it can be parsed into some new enum Dynamic { UInt64(u64), ... } (see serde_value::Value or serde_json::Value as references).

Btw the same type can be used after moving to Native or RowBinaryWithNamesAndTypes for any columns to solve https://github.com/ClickHouse/clickhouse-rs/issues/53 and https://github.com/ClickHouse/clickhouse-rs/issues/74

Moreover, we should also support BorrowedDynamic<'_> for borrowing queries. Otherwise, it's a huge load for an allocator.

loyd avatar Oct 19 '24 13:10 loyd