Skip to content

Commit

Permalink
fix: actually fix the issue
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Nov 30, 2023
1 parent d2954ef commit 0959062
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
4 changes: 0 additions & 4 deletions go/vt/vtgate/planbuilder/operators/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,6 @@ func (a *Aggregator) findColInternal(ctx *plancontext.PlanningContext, ae *sqlpa
if offset >= 0 {
return offset, err
}
expr, err = a.DT.RewriteExpression(ctx, expr)
if err != nil {
return 0, err
}

// Aggregator is little special and cannot work if the input offset are not matched with the aggregation columns.
// So, before pushing anything from above the aggregator offset planning needs to be completed.
Expand Down
37 changes: 23 additions & 14 deletions go/vt/vtgate/planbuilder/testdata/aggr_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -6034,24 +6034,33 @@
{
"OperatorType": "Aggregate",
"Variant": "Ordered",
"GroupBy": "0 COLLATE utf8mb4_0900_ai_ci",
"GroupBy": "(0|1)",
"Inputs": [
{
"OperatorType": "Aggregate",
"Variant": "Scalar",
"Aggregates": "min(0|2) AS min_id, max(1|2) AS max_id",
"OperatorType": "SimpleProjection",
"Columns": [
0,
3
],
"Inputs": [
{
"OperatorType": "Route",
"Variant": "Scatter",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select min(bb.id) as min_id, max(bb.id) as max_id, weight_string(bb.id) from `user` as bb where 1 != 1 group by weight_string(bb.id)",
"OrderBy": "0 ASC COLLATE utf8mb4_0900_ai_ci",
"Query": "select min(bb.id) as min_id, max(bb.id) as max_id, weight_string(bb.id) from `user` as bb group by weight_string(bb.id) order by min(bb.id) asc",
"Table": "`user`"
"OperatorType": "Aggregate",
"Variant": "Scalar",
"Aggregates": "min(0|2) AS min_id, max(1|2) AS max_id, any_value(3)",
"Inputs": [
{
"OperatorType": "Route",
"Variant": "Scatter",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select min(bb.id) as min_id, max(bb.id) as max_id, weight_string(bb.id), weight_string(min(bb.id)) from `user` as bb where 1 != 1 group by weight_string(bb.id)",
"OrderBy": "0 ASC",
"Query": "select min(bb.id) as min_id, max(bb.id) as max_id, weight_string(bb.id), weight_string(min(bb.id)) from `user` as bb group by weight_string(bb.id) order by min(bb.id) asc",
"Table": "`user`"
}
]
}
]
}
Expand Down

0 comments on commit 0959062

Please sign in to comment.