Skip to content

Add canonical Map arrays and builder - #9108

Draft
AdamGS wants to merge 1 commit into
adamg/maptype-1from
adamg/maptype-2
Draft

Add canonical Map arrays and builder#9108
AdamGS wants to merge 1 commit into
adamg/maptype-1from
adamg/maptype-2

Conversation

@AdamGS

@AdamGS AdamGS commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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.

@codspeed-hq

codspeed-hq Bot commented Jul 31, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 20.19%

⚡ 1 improved benchmark
✅ 1841 untouched benchmarks
⏩ 55 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation take_map[(0.1, 1.0)] 2 ms 1.6 ms +20.19%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing adamg/maptype-2 (b158bfe) with adamg/maptype-1 (a54e5f6)

Open in CodSpeed

Footnotes

  1. 55 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@AdamGS AdamGS added the changelog/feature A new feature label Jul 31, 2026
@AdamGS
AdamGS force-pushed the adamg/maptype-2 branch from 448cba5 to 7d9ceb3 Compare July 31, 2026 11:40
@AdamGS
AdamGS force-pushed the adamg/maptype-2 branch from 7d9ceb3 to dce5a97 Compare July 31, 2026 11:52
@AdamGS
AdamGS force-pushed the adamg/maptype-2 branch from dce5a97 to b158bfe Compare July 31, 2026 12:09
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant