Add a test for aggregation wrapped in ParenExpr

Signed-off-by: Lukasz Mierzwa <l.mierzwa@gmail.com>
This commit is contained in:
Lukasz Mierzwa 2025-02-14 15:46:37 +00:00
parent b74cebf6bf
commit b8a5386d4e

View file

@ -3947,6 +3947,26 @@ var testExpr = []struct {
}, },
}, },
}, },
{
input: "(sum(foo))",
expected: &ParenExpr{
Expr: &AggregateExpr{
Op: SUM,
Expr: &VectorSelector{
Name: "foo",
LabelMatchers: []*labels.Matcher{
MustLabelMatcher(labels.MatchEqual, model.MetricNameLabel, "foo"),
},
PosRange: posrange.PositionRange{
Start: 5,
End: 8,
},
},
PosRange: posrange.PositionRange{Start: 1, End: 9},
},
PosRange: posrange.PositionRange{Start: 0, End: 10},
},
},
} }
func makeInt64Pointer(val int64) *int64 { func makeInt64Pointer(val int64) *int64 {