-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable aggregates and group_by (#109)
### TL;DR Enhanced the query functionality to support multiple grouping fields and aggregations, with improved type handling for ClickHouse data types. ### What changed? - Modified `GroupBy` field in `QueryParams` to accept an array of strings instead of a single string - Added `GetAggregations` method to handle grouped and aggregated queries separately - Updated `Aggregations` field in `QueryResponse` to use `[]map[string]interface{}` for flexible result handling - Implemented comprehensive ClickHouse type mapping to Go types with support for nullable, array, and low cardinality types - Separated data retrieval logic in handlers to handle aggregations distinctly from regular queries - Added unit tests for ClickHouse type mapping functionality ### How to test? 1. Query logs/transactions endpoints with multiple group_by parameters 2. Test various aggregation functions (COUNT, SUM, etc.) with grouping 3. Verify response structure for both regular and aggregated queries 4. Test handling of different ClickHouse data types and their nullable variants 5. Run new unit tests for type mapping functionality ### Why make this change? This enhancement provides more robust support for data analysis by properly handling grouped queries and aggregations. The improved type mapping system ensures accurate data representation when working with ClickHouse's various data types, while maintaining clean separation between regular queries and aggregations.
- Loading branch information
Showing
10 changed files
with
513 additions
and
86 deletions.
There are no files selected for viewing
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
Oops, something went wrong.