[Enhancement]: Let aggregate_records (MCP) compute multiple aggregations in one call (single GROUP BY pass)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
Inizia dal parsing degli argomenti di MCP AggregateRecordsTool, quindi segui GroupByMetadata.Aggregations e BaseTSqlQueryBuilder.BuildAggregationColumns, incluso il percorso GraphQL esistente. Supporta l'array aggregations opzionale mantenendo function e field, e verifica che i risultati raggruppati generino una query con alias utilizzabili da orderby e having.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C#
- Stelle
- 1.5k
- Fork
- 371
- Merge medio
- 7g 5h
- PR unite (30g)
- 8
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Azure/data-api-builder
-
pgsql
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/data-api-builder#3598 ·
I maintainer di solito rispondono entro 1 giorno
-
2.x cli mcp-server
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/data-api-builder#3576 ·
I maintainer di solito rispondono entro 1 giorno
-
2.x health-endpoint
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/data-api-builder#3570 ·
I maintainer di solito rispondono entro 1 giorno
-
2.x telemetry
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/data-api-builder#3564 ·
I maintainer di solito rispondono entro 1 giorno
-
2.x telemetry
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Azure/data-api-builder#3562 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Azure/data-api-builder
Issue simili
-
area-ai untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
dotnet/extensions#7790 ·
I maintainer di solito rispondono entro 1 giorno
-
P2 testing
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dotnet/runtime#134766 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
0 - Backlog Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
BrighterCommand/Brighter#4444 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno