-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support v1 query API GROUP BY semantics
This updates the v1 /query API hanlder to handle InfluxDB v1's unique query response structure when GROUP BY clauses are provided. The distinction is in the addition of a "tags" field to the emitted series data that contains a map of the GROUP BY tags along with their distinct values associated with the data in the "values" field. This required splitting the QueryExecutor into two query paths for InfluxQL and SQL, as this allowed for handling InfluxQL query parsing in advance of query planning. A set of snapshot tests were added to check that it all works.
- Loading branch information
Showing
28 changed files
with
2,000 additions
and
150 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
influxdb3/tests/server/snapshots/server__query__api_v1_query_group_by-10.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
source: influxdb3/tests/server/query.rs | ||
description: "query: select * from bar group by /t[1,2]/, chunked: true" | ||
expression: values | ||
--- | ||
[ | ||
{ | ||
"results": [ | ||
{ | ||
"series": [ | ||
{ | ||
"columns": [ | ||
"time", | ||
"val" | ||
], | ||
"name": "bar", | ||
"tags": { | ||
"t1": "a", | ||
"t2": "aa" | ||
}, | ||
"values": [ | ||
[ | ||
"2065-01-07T17:28:51Z", | ||
1.0 | ||
] | ||
] | ||
} | ||
], | ||
"statement_id": 0 | ||
} | ||
] | ||
}, | ||
{ | ||
"results": [ | ||
{ | ||
"series": [ | ||
{ | ||
"columns": [ | ||
"time", | ||
"val" | ||
], | ||
"name": "bar", | ||
"tags": { | ||
"t1": "a", | ||
"t2": "bb" | ||
}, | ||
"values": [ | ||
[ | ||
"2065-01-07T17:28:53Z", | ||
3.0 | ||
] | ||
] | ||
} | ||
], | ||
"statement_id": 0 | ||
} | ||
] | ||
}, | ||
{ | ||
"results": [ | ||
{ | ||
"series": [ | ||
{ | ||
"columns": [ | ||
"time", | ||
"val" | ||
], | ||
"name": "bar", | ||
"tags": { | ||
"t1": "b", | ||
"t2": "aa" | ||
}, | ||
"values": [ | ||
[ | ||
"2065-01-07T17:28:52Z", | ||
2.0 | ||
] | ||
] | ||
} | ||
], | ||
"statement_id": 0 | ||
} | ||
] | ||
}, | ||
{ | ||
"results": [ | ||
{ | ||
"series": [ | ||
{ | ||
"columns": [ | ||
"time", | ||
"val" | ||
], | ||
"name": "bar", | ||
"tags": { | ||
"t1": "b", | ||
"t2": "bb" | ||
}, | ||
"values": [ | ||
[ | ||
"2065-01-07T17:28:54Z", | ||
4.0 | ||
] | ||
] | ||
} | ||
], | ||
"statement_id": 0 | ||
} | ||
] | ||
} | ||
] |
88 changes: 88 additions & 0 deletions
88
influxdb3/tests/server/snapshots/server__query__api_v1_query_group_by-11.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
source: influxdb3/tests/server/query.rs | ||
description: "query: select * from bar group by t1, t2, t3, chunked: false" | ||
expression: values | ||
--- | ||
[ | ||
{ | ||
"results": [ | ||
{ | ||
"series": [ | ||
{ | ||
"columns": [ | ||
"time", | ||
"val" | ||
], | ||
"name": "bar", | ||
"tags": { | ||
"t1": "b", | ||
"t2": "bb", | ||
"t3": "" | ||
}, | ||
"values": [ | ||
[ | ||
"2065-01-07T17:28:54Z", | ||
4.0 | ||
] | ||
] | ||
}, | ||
{ | ||
"columns": [ | ||
"time", | ||
"val" | ||
], | ||
"name": "bar", | ||
"tags": { | ||
"t1": "b", | ||
"t2": "aa", | ||
"t3": "" | ||
}, | ||
"values": [ | ||
[ | ||
"2065-01-07T17:28:52Z", | ||
2.0 | ||
] | ||
] | ||
}, | ||
{ | ||
"columns": [ | ||
"time", | ||
"val" | ||
], | ||
"name": "bar", | ||
"tags": { | ||
"t1": "a", | ||
"t2": "bb", | ||
"t3": "" | ||
}, | ||
"values": [ | ||
[ | ||
"2065-01-07T17:28:53Z", | ||
3.0 | ||
] | ||
] | ||
}, | ||
{ | ||
"columns": [ | ||
"time", | ||
"val" | ||
], | ||
"name": "bar", | ||
"tags": { | ||
"t1": "a", | ||
"t2": "aa", | ||
"t3": "" | ||
}, | ||
"values": [ | ||
[ | ||
"2065-01-07T17:28:51Z", | ||
1.0 | ||
] | ||
] | ||
} | ||
], | ||
"statement_id": 0 | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.