add more non GROUP BY * test scenarios
parent
b171ab6655
commit
e5bb5282da
|
@ -287,6 +287,10 @@ func TestWritePointsAndExecuteTwoShardsQueryRewrite(t *testing.T) {
|
|||
chunkSize int // Chunk size for driving the executor
|
||||
expected string // Expected results, rendered as a string
|
||||
}{
|
||||
{
|
||||
stmt: `SELECT * FROM cpu`,
|
||||
expected: `[{"name":"cpu","columns":["time","host","value1","value2"],"values":[["1970-01-01T00:00:01Z","serverA",100,null],["1970-01-01T00:00:02Z","serverB",null,200]]}]`,
|
||||
},
|
||||
{
|
||||
stmt: `SELECT * FROM cpu GROUP BY *`,
|
||||
expected: `[{"name":"cpu","tags":{"host":"serverA"},"columns":["time","value1","value2"],"values":[["1970-01-01T00:00:01Z",100,null]]},{"name":"cpu","tags":{"host":"serverB"},"columns":["time","value1","value2"],"values":[["1970-01-01T00:00:02Z",null,200]]}]`,
|
||||
|
|
|
@ -41,8 +41,14 @@ func TestWritePointsAndExecuteQuery(t *testing.T) {
|
|||
t.Fatalf(err.Error())
|
||||
}
|
||||
|
||||
got := executeAndGetJSON("SELECT * FROM cpu GROUP BY *", executor)
|
||||
exepected := `[{"series":[{"name":"cpu","tags":{"host":"server"},"columns":["time","value"],"values":[["1970-01-01T00:00:01.000000002Z",1],["1970-01-01T00:00:02.000000003Z",1]]}]}]`
|
||||
got := executeAndGetJSON("SELECT * FROM cpu", executor)
|
||||
exepected := `[{"series":[{"name":"cpu","columns":["time","host","value"],"values":[["1970-01-01T00:00:01.000000002Z","server",1],["1970-01-01T00:00:02.000000003Z","server",1]]}]}]`
|
||||
if exepected != got {
|
||||
t.Fatalf("\nexp: %s\ngot: %s", exepected, got)
|
||||
}
|
||||
|
||||
got = executeAndGetJSON("SELECT * FROM cpu GROUP BY *", executor)
|
||||
exepected = `[{"series":[{"name":"cpu","tags":{"host":"server"},"columns":["time","value"],"values":[["1970-01-01T00:00:01.000000002Z",1],["1970-01-01T00:00:02.000000003Z",1]]}]}]`
|
||||
if exepected != got {
|
||||
t.Fatalf("\nexp: %s\ngot: %s", exepected, got)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue