From 8e7f2e92cc7b34eb4e0c96d4527962b6d39ee1a9 Mon Sep 17 00:00:00 2001 From: dennis zhuang Date: Thu, 4 Sep 2025 20:18:27 +0800 Subject: [PATCH] test: adds approx_percentile_cont to range query test (#6903) Signed-off-by: Dennis Zhuang --- .../standalone/common/range/calculate.result | 17 +++++++++++++++++ .../cases/standalone/common/range/calculate.sql | 2 ++ 2 files changed, 19 insertions(+) diff --git a/tests/cases/standalone/common/range/calculate.result b/tests/cases/standalone/common/range/calculate.result index 416ee2d283..6ac21a9352 100644 --- a/tests/cases/standalone/common/range/calculate.result +++ b/tests/cases/standalone/common/range/calculate.result @@ -121,6 +121,23 @@ SELECT ts, host, floor(min(val) RANGE '5s') FROM host ALIGN '5s' ORDER BY host, | 1970-01-01T00:00:20 | host2 | 5.0 | +---------------------+-------+-------------------------------+ +SELECT ts, host, approx_percentile_cont(0.5) WITHIN GROUP (ORDER BY val) RANGE '5s' FROM host ALIGN '5s' ORDER BY host, ts; + ++---------------------+-------+--------------------------------------------------------------------------------------+ +| ts | host | approx_percentile_cont(Float64(0.5)) WITHIN GROUP [host.val ASC NULLS LAST] RANGE 5s | ++---------------------+-------+--------------------------------------------------------------------------------------+ +| 1970-01-01T00:00:00 | host1 | 0 | +| 1970-01-01T00:00:05 | host1 | | +| 1970-01-01T00:00:10 | host1 | 1 | +| 1970-01-01T00:00:15 | host1 | | +| 1970-01-01T00:00:20 | host1 | 2 | +| 1970-01-01T00:00:00 | host2 | 3 | +| 1970-01-01T00:00:05 | host2 | | +| 1970-01-01T00:00:10 | host2 | 4 | +| 1970-01-01T00:00:15 | host2 | | +| 1970-01-01T00:00:20 | host2 | 5 | ++---------------------+-------+--------------------------------------------------------------------------------------+ + -- Test complex range expr calculate SELECT ts, host, (min(val) + max(val)) RANGE '20s' + 1.0 FROM host ALIGN '10s' ORDER BY host, ts; diff --git a/tests/cases/standalone/common/range/calculate.sql b/tests/cases/standalone/common/range/calculate.sql index 6bbc7eb84e..f20df19391 100644 --- a/tests/cases/standalone/common/range/calculate.sql +++ b/tests/cases/standalone/common/range/calculate.sql @@ -30,6 +30,8 @@ SELECT ts, host, min(floor(val::DOUBLE)) RANGE '5s' FROM host ALIGN '5s' ORDER B SELECT ts, host, floor(min(val) RANGE '5s') FROM host ALIGN '5s' ORDER BY host, ts; +SELECT ts, host, approx_percentile_cont(0.5) WITHIN GROUP (ORDER BY val) RANGE '5s' FROM host ALIGN '5s' ORDER BY host, ts; + -- Test complex range expr calculate SELECT ts, host, (min(val) + max(val)) RANGE '20s' + 1.0 FROM host ALIGN '10s' ORDER BY host, ts;