Skip to content

Commit

Permalink
FIXUP - Move child group field propogation into p.GroupBy
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSisley committed Nov 19, 2021
1 parent dc730a1 commit 69f2633
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 6 additions & 0 deletions query/graphql/planner/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ func (p *Planner) GroupBy(n *parser.GroupBy, childSelect *parser.Select) (*group
return nil, nil
}

if childSelect != nil && childSelect.GroupBy != nil {
// group by fields have to be propogated downwards to ensure correct sub-grouping, otherwise child
// groups will only group on the fields they explicitly reference
childSelect.GroupBy.Fields = append(childSelect.GroupBy.Fields, n.Fields...)
}

groupNode := groupNode{
p: p,
childSelect: childSelect,
Expand Down
6 changes: 0 additions & 6 deletions query/graphql/planner/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,6 @@ func (p *Planner) expandGroupNodePlan(plan *selectTopNode) error {
}

if plan.group.childSelect != nil {
if plan.group.childSelect.GroupBy != nil {
// group by fields have to be propogated downwards to ensure correct sub-grouping, otherwise child
// groups will only group on the fields they explicitly reference
plan.group.childSelect.GroupBy.Fields = append(plan.group.childSelect.GroupBy.Fields, plan.group.groupByFields...)
}

childSelectNode, err := p.SelectFromSource(plan.group.childSelect, pipe, false, &plan.source.(*selectNode).sourceInfo)
if err != nil {
return err
Expand Down

0 comments on commit 69f2633

Please sign in to comment.