[Enhancement]: Let aggregate_records (MCP) compute multiple aggregations in one call (single GROUP BY pass)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
Bắt đầu từ việc phân tích đối số của MCP AggregateRecordsTool, sau đó lần theo GroupByMetadata.Aggregations và BaseTSqlQueryBuilder.BuildAggregationColumns, bao gồm cả đường dẫn GraphQL hiện có. Hỗ trợ mảng aggregations tùy chọn trong khi vẫn giữ nguyên function và field, đồng thời xác minh rằng các kết quả được nhóm tạo ra một truy vấn với các bí danh có thể được orderby và having sử dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem?
The MCP aggregate_records tool accepts only one aggregate per call (function + field). To retrieve several metrics over the same grouping, a client must issue N separate calls, each generating its own query with the same GROUP BY:
SELECT region, SUM(amount) FROM dbo.Sales WHERE ... GROUP BY region
SELECT region, AVG(amount) FROM dbo.Sales WHERE ... GROUP BY region
SELECT region, SUM(cost) FROM dbo.Sales WHERE ... GROUP BY region
This scans the same rows and recomputes the same GROUP BY N times, plus N× query-planning / result-shaping / round-trip overhead. On large tables/views this is a real, avoidable database cost. Issuing the N calls concurrently on the client side only reduces latency — it does not reduce total DB work and can increase peak load/contention.
Describe the solution you'd like
Allow aggregate_records to accept multiple aggregations in a single call, producing one SELECT with one GROUP BY pass, e.g.:
{
"entity": "Sales",
"aggregations": [
{ "function": "sum", "field": "amount", "alias": "sum_amount" },
{ "function": "avg", "field": "amount", "alias": "avg_amount" },
{ "function": "sum", "field": "cost", "alias": "sum_cost" }
],
"groupby": ["region"],
"orderby": ["sum_amount desc"]
}
which maps to a single query:
SELECT region, SUM(amount) AS sum_amount, AVG(amount) AS avg_amount, SUM(cost) AS sum_cost
FROM dbo.Sales
WHERE ...
GROUP BY region
orderby/having should be able to reference the aggregate aliases (e.g. sum_amount), consistent with how grouped results are projected.
Why this looks feasible
DAB already builds multi-aggregation queries internally for GraphQL: the shared SqlQueryStructure.GroupByMetadata.Aggregations is a List<AggregationOperation> and BaseTSqlQueryBuilder.BuildAggregationColumns(...) emits all requested aggregate expressions into a single SELECT. The MCP aggregate_records tool (AggregateRecordsTool) currently parses and loads only a single AggregationOperation. Extending its argument parsing to accept an array and pushing multiple AggregationOperations onto the existing structure would reuse the machinery GraphQL already relies on.
Backward compatibility
Keep the current single-metric form (function + field) working as-is; add the new optional aggregations array alongside it. Single-metric callers are unaffected; multi-metric callers opt in.
Additional context
- Related: #3695 (a separate correctness bug in the aggregate
ORDER BYfordwsql). This enhancement is independent of that fix. - Benefit is largest for wide analytical tables/views where several measures are aggregated over the same grouping in one logical request.
- Ngôn ngữ chính
- C#
- Star
- 1.5k
- Fork
- 371
- Merge trung bình
- 7 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/data-api-builder
-
pgsql
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3598 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2.x cli mcp-server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3576 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2.x health-endpoint
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3570 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2.x telemetry
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/data-api-builder#3564 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2.x telemetry
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Azure/data-api-builder#3562 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Azure/data-api-builder
Issue tương tự
-
area-ai untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
dotnet/extensions#7790 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
P2 testing
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/runtime#134766 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
0 - Backlog Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
BrighterCommand/Brighter#4444 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày