From 5fe8740fc0d74b369c3a7e03665284dc7632cb14 Mon Sep 17 00:00:00 2001
From: discord9 <55937128+discord9@users.noreply.github.com>
Date: Mon, 12 Oct 2026 13:11:50 +0800
Subject: [PATCH] test(promql): align avg_over_time expectation with Prometheus
name semantics
#9477 pinned the old behavior where the HTTP response writer stamped
every row with __name__=
. Under this PR's identity
lifecycle, value-changing functions such as avg_over_time drop the
metric-name identity, so the response carries job only. Also take the
upstream UnionExec snapshot drift (#9491) into the regenerated
tql-cte result.
Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
---
tests-integration/tests/http.rs | 6 +++++-
tests/cases/standalone/common/tql/tql-cte.result | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests-integration/tests/http.rs b/tests-integration/tests/http.rs
index 91979ddbf59..9f0973a5fcb 100644
--- a/tests-integration/tests/http.rs
+++ b/tests-integration/tests/http.rs
@@ -2567,12 +2567,16 @@ pub async fn test_promql_over_non_millisecond_physical_tables(store_type: Storag
.await;
assert_eq!(res.status(), StatusCode::OK);
let body = res.json::().await;
+ // The samples are 1.0@1s and 2.0@2s, so the 1m window at t=2 holds both: avg is 1.5.
+ // `avg_over_time` changes the sample values, so it drops the metric-name identity
+ // like every other value-changing PromQL function (see Prometheus semantics);
+ // `__name__` is absent from the result.
assert_eq!(
body.data,
serde_json::from_value::(json!({
"resultType": "vector",
"result": [{
- "metric": {"__name__": "unit_gauge", "job": "demo"},
+ "metric": {"job": "demo"},
"value": [2.0, "1.5"]
}]
}))
diff --git a/tests/cases/standalone/common/tql/tql-cte.result b/tests/cases/standalone/common/tql/tql-cte.result
index 711174a41c8..ff7f3ac7ecc 100644
--- a/tests/cases/standalone/common/tql/tql-cte.result
+++ b/tests/cases/standalone/common/tql/tql-cte.result
@@ -625,7 +625,7 @@ SELECT 'host2' as source, ts, cpu FROM host2_data;
| | Filter: labels.host = Utf8("host2") AND labels.ts >= TimestampMillisecond(-299999, None) AND labels.ts <= TimestampMillisecond(40000, None) |
| | TableScan: labels, partial_filters=[labels.host = Utf8("host2"), labels.ts >= TimestampMillisecond(-299999, None), labels.ts <= TimestampMillisecond(40000, None)] |
| | ]] |
-| physical_plan | InterleaveExec |
+| physical_plan | UnionExec |
| | CooperativeExec |
| | MergeScanExec: REDACTED
| | CooperativeExec |