Skip to content

Commit

Permalink
test: update end-to-end test
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Feb 6, 2024
1 parent a3fa7ab commit 7fb0f26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go/test/endtoend/vtgate/queries/subquery/subquery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func TestSubqueryInAggregation(t *testing.T) {
mcmp.Exec("insert into t1(id1, id2) values(0,0),(1,1)")
mcmp.Exec("insert into t2(id3, id4) values(1,2),(5,7)")
mcmp.Exec(`SELECT max((select min(id2) from t1)) FROM t2`)
mcmp.Exec(`SELECT max((select group_concat(id1, id2) from t1 where id1 = 1)) FROM t1 where id1 = 1`)
mcmp.Exec(`SELECT max((select group_concat(id1, id2) from t1 where id1 = 1)) as x FROM t1 where id1 = 1`)
mcmp.Exec(`SELECT max((select min(id2) from t1 where id2 = 1)) FROM dual`)
mcmp.Exec(`SELECT max((select min(id2) from t1)) FROM t2 where id4 = 7`)

Expand Down
15 changes: 7 additions & 8 deletions go/vt/vtgate/planbuilder/operators/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,16 +421,15 @@ func (a *Aggregator) introducesTableID() semantics.TableSet {
func (a *Aggregator) checkForInvalidAggregations() {
for _, aggr := range a.Aggregations {
_ = sqlparser.Walk(func(node sqlparser.SQLNode) (kontinue bool, err error) {
aggrFunc, isAggregate := node.(sqlparser.AggrFunc)
if !isAggregate {
return true, nil
}
args := aggrFunc.GetArgs()
if args != nil && len(args) != 1 {
panic(vterrors.VT03001(sqlparser.String(node)))
switch node := node.(type) {
case *sqlparser.GroupConcatExpr:
// can have multiple arguments
case sqlparser.AggrFunc:
if len(node.GetArgs()) > 1 {
panic(vterrors.VT03001(sqlparser.String(node)))
}
}
return true, nil

}, aggr.Original.Expr)
}
}
Expand Down

0 comments on commit 7fb0f26

Please sign in to comment.