Add the summarize operator - #54
Open
davidanthoff wants to merge 1 commit into
Open
Conversation
Adds QueryOperators.summarize for grouped and whole-table aggregation: grouped input (eltype <: Grouping) lowers to a lazy map over the groups; ungrouped input is treated as a single keyless group via the new lazy one-row EnumerableSummarizeAll. The _key_namedtuple helper normalizes grouping keys into result columns (NamedTuple keys splat, scalar keys become a column named key, the internal keyless marker contributes none). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
davidanthoff
added a commit
to queryverse/Query.jl
that referenced
this pull request
Sep 1, 2026
The @summarize macro now expands to QueryOperators.summarize (added in queryverse/QueryOperators.jl#54); the EnumerableSummarizeAll type, the keyless-Grouping sentinel and the key normalization helpers move there. Requires QueryOperators 1.1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Adds
QueryOperators.summarize(source::Enumerable, f, f_expr)— the operator layer for the new@summarizemacro in queryverse/Query.jl#356, moved here so it lives alongside the other enumerables and so the generic function is open for backend methods (QueryOperators.summarize(::Queryable, ...)can be overloaded by plan-capturing backends later).What it does
eltype(source) <: Grouping): lowers to a lazymapover the groups — one output row per group.EnumerableSummarizeAll, which on first iterate collects the rows into aGroupingkeyed by the internal_SummarizeUngroupedKeysentinel, so column access on the group works identically in both paths._key_namedtuplenormalizes grouping keys into result columns: NamedTuple keys splat into one column per field, a scalar key becomes a column namedkey, and the keyless sentinel contributes no columns. Query.jl's@summarizemerges this in front of the aggregate columns.function summarize endstub sits inoperators.jlnext topivot_longer/pivot_wider.Both paths produce a concrete inferred row eltype (verified with
isconcretetypetests), since downstream operators rely onBase._return_type.Notes
QueryOperators = "1.1"compat, so this needs to be merged and registered before that PR's CI can go green.HasLength, length 1, no key columns, empty source), and eltype concreteness.🤖 Generated with Claude Code