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

how to support map?

Open strive-run opened this issue 1 year ago • 3 comments

image

ck table columns: image

and rust struct : image

when execute insert, error: thread 'main' panicked at /Users/gao.wei.strive/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/clickhouse-0.11.6/src/rowbinary/ser.rs:168:9: not yet implemented

please help me , thanks.

strive-run avatar Jan 30 '24 04:01 strive-run

+1, same problem

caibirdme avatar Jul 19 '24 09:07 caibirdme

The documentation is not precise enough. It literally means "serialize as Array((K, V))", so you can use Vec<(String, String)> and so on here.

What's Map, serialize_map, and (most important!) Value in your example?

loyd avatar Jul 25 '24 09:07 loyd

It's possible to support real maps (HashMap, BTreeMap, IndexMap etc) directly without using &[tuple], but it opens a large space for bugs because of #[serde(flatten)], serde_value::Value and other things which all should be handled correctly (or it ends with a lot of issues because of schema mismatch), that's not trivial.

loyd avatar Jul 25 '24 09:07 loyd