Skip to content

fix(core): preserve extended aggregate sorts and options - #1264

Draft
bvolpato wants to merge 1 commit into
substrait-io:mainfrom
bvolpato:bvolpato/fix-extended-aggregate-semantics
Draft

fix(core): preserve extended aggregate sorts and options#1264
bvolpato wants to merge 1 commit into
substrait-io:mainfrom
bvolpato:bvolpato/fix-extended-aggregate-semantics

Conversation

@bvolpato

@bvolpato bvolpato commented Sep 3, 2026

Copy link
Copy Markdown
Member

Extended-expression serialization drops aggregate sort fields and function options. An ordered string_agg therefore loses its ordering, and a SUM with overflow preferences loses the selected behavior. Functions referenced only by sort expressions also disappear from the extension declarations.

The loss occurs across the normal conversion path:

ExtendedExpression restored = new ProtoExtendedExpressionConverter().from(
    new ExtendedExpressionProtoConverter().toProto(expression));

Serialize the sort expressions and directions using the same expression converter and extension collector as the arguments, and preserve function-option preference order. This brings extended aggregates into line with aggregate-relation serialization.

Partially addresses #1093 for aggregate sorts and options.

Serialize sort expressions through the shared extension collector and
retain sort directions and function-option preference order.
@bvolpato
bvolpato force-pushed the bvolpato/fix-extended-aggregate-semantics branch from 646b87e to 1cb4864 Compare September 4, 2026 16:25
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.

1 participant