Add Map logical type and scalar support - #9107
Merged
Merged
Conversation
Merging this PR will regress 1 benchmark
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
AdamGS
force-pushed
the
adamg/maptype-1
branch
4 times, most recently
from
July 31, 2026 13:17
a54e5f6 to
bad889a
Compare
robert3005
approved these changes
Aug 4, 2026
AdamGS
force-pushed
the
adamg/maptype-1
branch
2 times, most recently
from
August 4, 2026 11:52
5b965da to
7821711
Compare
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
AdamGS
marked this pull request as ready for review
August 4, 2026 14:47
AdamGS
added a commit
that referenced
this pull request
Aug 4, 2026
## Rationale for this change Building on the logical type and scalar support in #9107, this makes map-typed arrays constructible, canonicalizable, and serializable. A dedicated canonical representation preserves Map semantics instead of treating maps as ordinary lists of structs. ## What changes are included in this PR? - Adds the `vortex.map` canonical encoding, backed by `ListView<Struct<key, value>>` storage while retaining the Map dtype and `keys_sorted` assertion. - Adds `MapArray`, validated construction, entry access, validity delegation, scalar access, serialization, and session registration. - Adds `MapBuilder` and integrates Map values with generic builder and canonicalization paths, including empty, constant, and chunked arrays. - Tests cover valid and malformed storage, nullable and empty values, duplicate and unsorted keys, builder append behavior, canonicalization, scalar access, and serialization round-trips. ## What APIs are changed? Are there any user-facing changes? This adds the public `Map`, `MapArray`, `MapArrayExt`, `MapDataParts`, and `MapBuilder` APIs. `Canonical` and `CanonicalView` gain Map variants and corresponding accessors, so exhaustive matches over those enums must handle Map arrays. Map arrays can now be built, canonicalized, inspected, and serialized. Compute paths such as take, filter, masking, compression, and Arrow array transport continue to reject Map arrays at this point in the stack. Signed-off-by: Adam Gutglick <adam@spiraldb.com>
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.
Rationale for this change
Vortex currently has no native logical map type, so Arrow maps must be represented as lists of structs and lose map-specific semantics such as non-null keys and the
keys_sortedassertion. This provides the type-level foundation for native Map support; #9108 builds on it with canonical arrays and builders. Related to #428.What changes are included in this PR?
DType::MapandMapDType, including key/value dtypes, outer nullability, sortedness, validation, coercion, display, equality, and hashing.Scalar::map,Scalar::try_map, andMapScalar.What APIs are changed? Are there any user-facing changes?
This adds the public
DType::MapandScalarValue::Mapvariants,MapDType,MapScalar, and their constructors and accessors. Consumers that exhaustively matchDTypeorScalarValuemust handle the new variants. The Protobuf and FlatBuffers dtype schemas also gain Map variants.This PR supports Map dtypes, schemas, and scalars, but not full Arrow
MapArraytransport.