Repository navigation
Render IPv4-embedded inet6 values as inet_out does - #280
Merged
Merged
Conversation
inet_out prints the last 32 bits of an IPv4-compatible (::a.b.c.d) or IPv4-mapped (::ffff:a.b.c.d) address as a dotted quad. The decoder rendered them as hex groups, so a streamed ::ffff:192.168.0.1 reached ClickHouse as ::ffff:c0a8:1. Optimize out allocating Vec, & work with constant sized chunks Co-Authored-By: serprex <159546+serprex@users.noreply.github.com>
serprex
force-pushed
the
fix-inet-mapped-ipv4-text
branch
from
October 28, 2026 11:17
9836f16 to
219d20c
Compare
serprex
approved these changes
Oct 28, 2026
harshil-goel
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Streamed
inetandcidrvalues don't match PostgreSQLinet_outwhen an IPv6 address embeds an IPv4 address.inet_outprints the last 32 bits of an IPv4-mapped (::ffff:a.b.c.d) or IPv4-compatible (::a.b.c.d) address as a dotted quad. The WAL decoder printed them as hex groups, and both types land in a ClickHouseStringcolumn.inet_out'::ffff:192.168.0.1'::inet::ffff:192.168.0.1::ffff:c0a8:1'::ffff:192.168.0.1/120'::inet::ffff:192.168.0.1/120::ffff:c0a8:1/120'::192.168.0.1'::inet::192.168.0.1::c0a8:1write_ipv6now follows the encapsulated IPv4 check ininet_net_ntop_ipv6(src/port/inet_net_ntop.c): when the longest zero run starts the address and covers six groups, or five groups followed byffff, the last four bytes print as a dotted quad. PostgreSQL's third branch (best.len == 7) can't be reached at group 6, because that group falls inside the zero run. Other addresses render as before.Testing
inet_ipv6_embedded_ipv4_keeps_dotted_quadchecks the rows above, plus::fffe:c0a8:1, which must stay hex. It fails onmainand passes with this change.cargo test --lib codecs::inet,cargo fmt --all -- --checkandcargo clippy --lib --tests -- -D warningspass.Fixes #279