ClickHouse / ClickHouse/clickhouse-rs
Support for `rust_decimal::Decimal` in RowBinaryWithNamesAndTypes Deserialization
- Dominant language
- Rust
- Stars
- 559
- Forks
- 173
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 3
Description
# 💡 Support for `rust_decimal::Decimal` in RowBinaryWithNamesAndTypes Deserialization
### Summary
After upgrading from `clickhouse = 0.13.3` to `0.14.0`, direct deserialization attempt of `Decimal` columns into `rust_decimal::Decimal` no longer works.
The driver now throws:
**DeserializeAnyNotSupported**
### Environment
- **clickhouse crate:** 0.14.x
- **rust_decimal:** 1.x
- **ClickHouse server:** 24.x
- **Rust:** 1.89
---
### Example Code
```rust
#[derive(clickhouse::Row, serde::Deserialize, Debug)]
struct SpotPrice {
hour_of_day: u8,
spot_price_eur: rust_decimal::Decimal,
}
let rows = ch_client
.query("SELECT hour_of_day, spot_price_eur FROM elspotprices LIMIT 5")
.fetch_all::()
.await?;
```
If I change the field type to f32, it works correctly, but that loses precision when working with financial or energy pricing data.
Contributor guide
Assessment
This issue has not been assessed yet.