ClickHouse / ClickHouse/clickhouse-rs

Support `std::net::Ipv4Addr` without a custom serde attribute

Open
#231 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
559
Forks
172
Avg merge
1d 19h
Merged PRs (30d)
3

Description

Only after #221.

If we somehow implement a conditional `ReverseSeqAccess`, e.g., via the `InnerDataTypeValidator`, adding a new branch like `ReversedArray`, then we can get rid of custom serde for `IPv4` and just use plain `std::net::Ipv4Addr`, similarly to `std::net::Ipv6Addr`.

Currently, without the serde attribute, the `IPv4` ends up being reversed. This is slightly annoying, since `IPv6` does not require any special treatment.

IIUIC, that is because [ClickHouse stores `IPv4` as a little-endian `UInt32`](https://clickhouse.com/docs/sql-reference/data-types/ipv4), but serde by default calls deserialization on `[u8; 4]` as `IPv4` can be constructed from a big-endian byte array representing `u32`.

Contributor guide

Open the contributing guide

Research direction

Start by reading the prerequisite work in #221, then trace InnerDataTypeValidator and ReverseSeqAccess to understand how a conditional reversed sequence access could be introduced. Done means plain std::net::Ipv4Addr deserializes correctly without a custom serde attribute, while existing IPv6 behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.