-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support v1 query API GROUP BY semantics #25845
Conversation
5dc5f3c
to
9ca6f0b
Compare
@@ -292,6 +320,55 @@ async fn query_database( | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, there is a bit of code repetition between this and the query_database_sql
method.
} | ||
|
||
// NOTE: the below code is currently copied from IOx and needs to be made pub so we can | ||
// re-use it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will open an issue in IOx to make these types visible from the appropriate crates.
9ca6f0b
to
dceb6b6
Compare
// TODO: this is defined in schema crate, so needs to be made pub there: | ||
const COLUMN_METADATA_KEY: &str = "iox::column::type"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to expose this in IOx as part of follow up work.
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.
dceb6b6
to
6b6a555
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tricky one, nice work 🚢
/// ```text | ||
/// select * from foo group by t1, t2 | ||
/// ``` | ||
/// If `t1` is a tag in the table, but `t2` is not, nor is a field in the table, then the v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super gnarly. Wow, the v1 API...
Closes #25751
Closes #25831
This updates the v1
/query
API handler to handle InfluxDB v1's unique query response structure whenGROUP BY
clauses are provided (#25751).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.
A set of snapshot tests were added to check that the structure of the data is correct when the carious kind of
GROUP BY
clauses are provided.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 (#25831).