Repository navigation
feat: read a Map in its order, its repeated keys kept (Options.OrderedMaps) - #2148
Draft
MicahParks wants to merge 3 commits into
Draft
MicahParks wants to merge 3 commits into
MicahParks wants to merge 3 commits into
Conversation
…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.
|
|
Contributor
AI review gate — Draft pull request — AI review not started
What to do:
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.
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.
Summary
Options.OrderedMaps(ordered_mapsin a DSN) reads aMapas[]column.MapEntry: entries in stored order, repeated keys kept, keys of any type.A
Tupleinside aTupleis read at every depth,Tuple()is a column, and a quoted element name can contain a space.Checklist