Skip to content

Commit

Permalink
update test case
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <benye@amazon.com>
  • Loading branch information
yeya24 committed Nov 11, 2022
1 parent 8d021b7 commit 5ed0166
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions pkg/querysharding/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pkg/querysharding/analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
}
Expand Down

0 comments on commit 5ed0166

Please sign in to comment.