Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

sql/analyzer: fix having resolution #780

Merged
merged 1 commit into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1237,11 +1237,34 @@ var queries = []struct {
{
`SELECT ARRAY_LENGTH("foo")`,
[]sql.Row{{nil}},
},
{
},
{
`SELECT * FROM mytable WHERE NULL AND i = 3`,
[]sql.Row{},
},
{
`SELECT 1 FROM mytable GROUP BY i HAVING i > 1`,
[]sql.Row{{int64(1)}, {int64(1)}},
},
{
`SELECT avg(i) FROM mytable GROUP BY i HAVING avg(i) > 1`,
[]sql.Row{{float64(2)}, {float64(3)}},
},
{
`SELECT s AS s, COUNT(*) AS count, AVG(i) AS ` + "`AVG(i)`" + `
FROM (
SELECT * FROM mytable
) AS expr_qry
GROUP BY s
HAVING ((AVG(i) > 0))
ORDER BY count DESC
LIMIT 10000`,
[]sql.Row{
{"first row", int64(1), float64(1)},
{"second row", int64(1), float64(2)},
{"third row", int64(1), float64(3)},
},
},
}

func TestQueries(t *testing.T) {
Expand Down
Loading