From 5cec0d4e3aa85b2be99f02a9a3ce5a1bac2223ef Mon Sep 17 00:00:00 2001 From: yihong Date: Tue, 12 Aug 2025 14:38:01 +0800 Subject: [PATCH] fix: http and tql should return the same value for nuknown (#6718) Signed-off-by: yihong0618 --- src/servers/src/http/result/prometheus_resp.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/servers/src/http/result/prometheus_resp.rs b/src/servers/src/http/result/prometheus_resp.rs index bba507b676..50af912122 100644 --- a/src/servers/src/http/result/prometheus_resp.rs +++ b/src/servers/src/http/result/prometheus_resp.rs @@ -185,6 +185,14 @@ impl PrometheusJsonResponse { metric_name: Option, result_type: ValueType, ) -> Result { + // Return empty result if no batches + if batches.iter().next().is_none() { + return Ok(PrometheusResponse::PromData(PromData { + result_type: result_type.to_string(), + ..Default::default() + })); + } + // infer semantic type of each column from schema. // TODO(ruihang): wish there is a better way to do this. let mut timestamp_column_index = None;