mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-12 23:12:28 +00:00
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__=<table 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>
This commit is contained in:
@@ -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::<PrometheusJsonResponse>().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::<PrometheusResponse>(json!({
|
||||
"resultType": "vector",
|
||||
"result": [{
|
||||
"metric": {"__name__": "unit_gauge", "job": "demo"},
|
||||
"metric": {"job": "demo"},
|
||||
"value": [2.0, "1.5"]
|
||||
}]
|
||||
}))
|
||||
|
||||
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user