Skip to content

Commit

Permalink
orderby: add test
Browse files Browse the repository at this point in the history
Signed-off-by: Vicent Marti <[email protected]>
  • Loading branch information
vmg committed Mar 8, 2024
1 parent 9ee4f36 commit ee0f9b4
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions go/test/endtoend/vtgate/queries/orderby/orderby_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func TestOrderByComplex(t *testing.T) {
"select email, max(col) as max_col from (select email, col from user where col > 20) as filtered group by email order by max_col",
"select a.email, a.max_col from (select email, max(col) as max_col from user group by email) as a order by a.max_col desc",
"select email, max(col) as max_col from user where email like 'a%' group by email order by max_col, email",
`select email, max(col) as max_col from user group by email union select email, avg(col) as avg_col from user group by email order by email desc`,
}

for _, query := range queries {
Expand All @@ -153,23 +154,3 @@ func TestOrderByComplex(t *testing.T) {
})
}
}

func TestBug(t *testing.T) {
mcmp, closer := start(t)
defer closer()

mcmp.Exec("insert into user(id, col, email) values(1,1,'a'), (2,2,'Abc'), (3,3,'b'), (4,4,'c'), (5,2,'test'), (6,1,'test'), (7,2,'a'), (8,3,'b'), (9,4,'c3'), (10,2,'d')")

query := `select email, max(col) as max_col
from user
group by email
union
select email, avg(col) as avg_col
from user
group by email
order by email desc`

mcmp.Run(query, func(mcmp *utils.MySQLCompare) {
_ = mcmp.Exec(query)
})
}

0 comments on commit ee0f9b4

Please sign in to comment.