Skip to content

feat: read a Map in its order, its repeated keys kept (Options.OrderedMaps) - #2148

Draft
MicahParks wants to merge 3 commits into
ClickHouse:mainfrom
MicahParks:v2-fixes
Draft

MicahParks wants to merge 3 commits into
ClickHouse:mainfrom
MicahParks:v2-fixes

Conversation

@MicahParks

@MicahParks MicahParks commented Nov 20, 2026 •

Copy link
Copy Markdown

Summary

Options.OrderedMaps (ordered_maps in a DSN) reads a Map as []column.MapEntry: entries in stored order, repeated keys kept, keys of any type.

A Tuple inside a Tuple is read at every depth, Tuple() is a column, and a quoted element name can contain a space.

Checklist

  • Unit and integration tests covering the common scenarios were added

…dMaps)

ClickHouse's Map is an array of key-value pairs: it keeps the order its
entries were written in, may hold a key more than once, and may have keys
of any type. A Go map keeps none of that.

With Options.OrderedMaps (ordered_maps in a DSN), a Map's Row, and so
database/sql, gives []column.MapEntry, at every depth: inside an Array,
a Tuple, a Map, a Variant, or a Dynamic. Scan takes *[]column.MapEntry
with or without it, and a Map whose keys are not comparable, such as
Map(Tuple(UInt8, String), UInt8), is read only with it. Append and
AppendRow take []column.MapEntry.
@cla-assistant

cla-assistant Bot commented Nov 20, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

AI review gate — Draft pull request — AI review not started

  • Cursor Bugbot does not review draft pull requests, so the gate cannot pass yet.

What to do:

  • Mark the pull request Ready for review. Bugbot then reviews it.
  • The bot re-runs this gate automatically when you mark the pull request ready or the review lands; or comment /ai-gate check.

Re-run the gate with “Re-run jobs” after an approval or a finished review. A push re-runs it automatically.

…t name

A `Tuple` that holds an unnamed `Tuple` was not read by Row, and so not
by database/sql or by a scan into any. The inner `Tuple` came back as
nil or as a map with the one key "", and Row panicked for an `Array` of
such a `Tuple`. An unnamed `Tuple` is now a slice at every depth, as it
is at the top, and a scan of one into any gives []any, not an error.
An `Array` of `Tuple` inside a `Tuple` keeps its depth: there,
`Array(Array(Tuple(a UInt8)))` was read as one level and lost entries.

`Tuple()` is a column: the server writes one byte for each row of it.
Row gives an empty []any, and Append and AppendRow take one.

An element name in backquotes can contain a space, a comma, or a
bracket. A string in the type of an element, such as one of an `Enum8`,
can contain a comma or a bracket.
An HTTP query's progress callback was never called, so an INSERT's written rows and a query's rows read were unknown over HTTP. The summary header is given to the callback once, as the native protocol gives its progress packets. It counts what the server did before its first block of data: all of a query that returns none, and all of one with wait_end_of_query.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant