From da319c0e982630f77227f6a15b9c83ec24508b85 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Fri, 11 Nov 2022 00:31:54 -0800 Subject: [PATCH] update test case Signed-off-by: Ben Ye --- pkg/querysharding/analyzer.go | 5 +---- pkg/querysharding/analyzer_test.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/querysharding/analyzer.go b/pkg/querysharding/analyzer.go index 3f888c8a830..1009af25751 100644 --- a/pkg/querysharding/analyzer.go +++ b/pkg/querysharding/analyzer.go @@ -68,10 +68,7 @@ func (a *CachedQueryAnalyzer) Analyze(query string) (QueryAnalysis, error) { // Analyze uses the following algorithm: // - if a query has subqueries, such as label_join or label_replace, // or has functions which cannot be sharded, then treat the query as non shardable. -// - if the query's root expression has grouping labels, -// then treat the query as shardable by those labels. -// - if the query's root expression has no grouping labels, -// then walk the query and find the least common labelset +// - Walk the query and find the least common labelset // used in grouping expressions. If non-empty, treat the query // as shardable by those labels. // - otherwise, treat the query as non-shardable. diff --git a/pkg/querysharding/analyzer_test.go b/pkg/querysharding/analyzer_test.go index 526ea6f5aed..fe14f2f58a5 100644 --- a/pkg/querysharding/analyzer_test.go +++ b/pkg/querysharding/analyzer_test.go @@ -139,7 +139,7 @@ sum by (container) ( }, { name: "ignore vector matching with 2 aggregations", - expression: `sum(rate(node_cpu_seconds_total[3h]offset 1m)) by (cluster_id, mode) / ignoring(mode) group_left sum(rate(node_cpu_seconds_total[3h]offset 1m)) by (cluster_id)`, + expression: `sum(rate(node_cpu_seconds_total[3h])) by (cluster_id, mode) / ignoring(mode) group_left sum(rate(node_cpu_seconds_total[3h])) by (cluster_id)`, shardingLabels: []string{"cluster_id"}, }, }