Skip to content

Add support for grouping set index in Aggregate #527

Description

@nielspardon

The current derivceRecordType() method does not correctly add the grouping set index column as documented in the current specification for Aggregate:

Direct Output Order: The list of grouping expressions in declaration order followed by the list of measures in declaration order, followed by an i32 describing the associated particular grouping set the value is derived from (if applicable).

https://substrait.io/relations/logical_relations/#aggregate-operation

protected Type.Struct deriveRecordType() {
return TypeCreator.REQUIRED.struct(
Stream.concat(
// unique grouping expressions
getGroupings().stream()
.flatMap(g -> g.getExpressions().stream())
.collect(Collectors.toCollection(LinkedHashSet::new))
.stream()
.map(Expression::getType),
// measures
getMeasures().stream().map(t -> t.getFunction().getType())));
}

This was uncovered in #508 which fixes the nullability for grouping set columns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    corePull requests that update java code

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions