diff --git a/tests/cases/standalone/common/promql/label.result b/tests/cases/standalone/common/promql/label.result index 3fe8d559221..f6e169eebe3 100644 --- a/tests/cases/standalone/common/promql/label.result +++ b/tests/cases/standalone/common/promql/label.result @@ -484,3 +484,52 @@ DROP TABLE test; Affected Rows: 0 +-- Issue 9444 -- +-- Normalizing mixed histogram boundary representations must not be rejected while +-- another label still tells the series apart. +CREATE TABLE demo_bucket ( + ts timestamp(3) time index, + instance STRING, + le STRING, + val DOUBLE, + PRIMARY KEY(instance, le), +); + +Affected Rows: 0 + +INSERT INTO TABLE demo_bucket VALUES + (3000000, 'a', '10', 40), + (3000000, 'a', '100', 50), + (3000000, 'a', '+Inf', 50), + (3000000, 'b', '10.0', 40), + (3000000, 'b', '100.0', 50), + (3000000, 'b', '1000.0', 50), + (3000000, 'b', '+Inf', 50); + +Affected Rows: 7 + +-- SQLNESS SORT_RESULT 3 1 +TQL EVAL (3000, 3000, '5s') label_replace(demo_bucket, "le", "$1", "le", "([0-9]+)[.]0+"); + ++---------------------+------+------+----------+ +| ts | val | le | instance | ++---------------------+------+------+----------+ +| 1970-01-01T00:50:00 | 40.0 | 10 | a | +| 1970-01-01T00:50:00 | 40.0 | 10 | b | +| 1970-01-01T00:50:00 | 50.0 | +Inf | a | +| 1970-01-01T00:50:00 | 50.0 | +Inf | b | +| 1970-01-01T00:50:00 | 50.0 | 100 | a | +| 1970-01-01T00:50:00 | 50.0 | 100 | b | +| 1970-01-01T00:50:00 | 50.0 | 1000 | b | ++---------------------+------+------+----------+ + +-- Aggregating `instance` away first makes the same rewrite collapse two series into +-- one label set, which is a genuine duplicate and must still fail. +TQL EVAL (3000, 3000, '5s') label_replace(sum by (le) (demo_bucket), "le", "$1", "le", "([0-9]+)[.]0+"); + +Error: 3001(EngineExecuteQuery), Execution error: vector cannot contain metrics with the same labelset + +DROP TABLE demo_bucket; + +Affected Rows: 0 + diff --git a/tests/cases/standalone/common/promql/label.sql b/tests/cases/standalone/common/promql/label.sql index 6c2d64d42ac..e269b6a1783 100644 --- a/tests/cases/standalone/common/promql/label.sql +++ b/tests/cases/standalone/common/promql/label.sql @@ -144,3 +144,32 @@ TQL EVAL (0, 1, '5s') test{job=""}; TQL EVAL (0, 1, '5s') test{job!=""}; DROP TABLE test; + +-- Issue 9444 -- +-- Normalizing mixed histogram boundary representations must not be rejected while +-- another label still tells the series apart. +CREATE TABLE demo_bucket ( + ts timestamp(3) time index, + instance STRING, + le STRING, + val DOUBLE, + PRIMARY KEY(instance, le), +); + +INSERT INTO TABLE demo_bucket VALUES + (3000000, 'a', '10', 40), + (3000000, 'a', '100', 50), + (3000000, 'a', '+Inf', 50), + (3000000, 'b', '10.0', 40), + (3000000, 'b', '100.0', 50), + (3000000, 'b', '1000.0', 50), + (3000000, 'b', '+Inf', 50); + +-- SQLNESS SORT_RESULT 3 1 +TQL EVAL (3000, 3000, '5s') label_replace(demo_bucket, "le", "$1", "le", "([0-9]+)[.]0+"); + +-- Aggregating `instance` away first makes the same rewrite collapse two series into +-- one label set, which is a genuine duplicate and must still fail. +TQL EVAL (3000, 3000, '5s') label_replace(sum by (le) (demo_bucket), "le", "$1", "le", "([0-9]+)[.]0+"); + +DROP TABLE demo_bucket;