Skip to content

Add map functions#1461

Open
timsaucer wants to merge 7 commits intoapache:mainfrom
timsaucer:add-map-functions
Open

Add map functions#1461
timsaucer wants to merge 7 commits intoapache:mainfrom
timsaucer:add-map-functions

Conversation

@timsaucer
Copy link
Copy Markdown
Member

@timsaucer timsaucer commented Mar 29, 2026

Which issue does this PR close?

Closes #1448

Rationale for this change

These functions were not exposed but are available upstream.

What changes are included in this PR?

Expose functions.
Add python wrappers.
Add unit tests.

Are there any user-facing changes?

New addition only.

Disclaimer

Most of this code was written with an AI agent, but every line has been reviewed by me and I am willing to discuss all design decisions.

timsaucer and others added 7 commits March 29, 2026 12:52
…ntries, element_at)

Closes apache#1448

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
element_at is already a Python-only alias for map_extract,
so the Rust binding is unnecessary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
make_map now takes a dict for the common case and also supports
separate keys/values lists for column expressions. Non-Expr keys
and values are automatically converted to literals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
map() now supports three calling conventions matching upstream:
- map({"a": 1, "b": 2}) — from a Python dictionary
- map([keys], [values]) — two lists that get zipped
- map(k1, v1, k2, v2, ...) — variadic key-value pairs

Non-Expr keys and values are automatically converted to literals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add examples for all three map() calling conventions
- Use clearer descriptions instead of jargon (no "zipped" or "variadic")
- Break map_keys/map_values/map_extract/map_entries examples into
  two steps: create the map column first, then call the function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@timsaucer timsaucer marked this pull request as ready for review March 29, 2026 23:03
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.

Add map functions (map, map_keys, map_values, map_extract, map_entries, element_at)

1 participant