mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-30 15:36:59 +00:00
* feat: improve SQL analyze scan diagnostics Signed-off-by: evenyag <realevenyag@gmail.com> * test: redact dynamic filters in sqlness results Signed-off-by: evenyag <realevenyag@gmail.com> * test: stabilize analyze snapshots for merge queue Signed-off-by: evenyag <realevenyag@gmail.com> * test: remove obsolete scan_details assertion Signed-off-by: evenyag <realevenyag@gmail.com> * test: refresh explain snapshots after partition filter changes Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com>
42 lines
1.3 KiB
SQL
42 lines
1.3 KiB
SQL
-- Minimal repro for histogram quantile over multi-partition input.
|
|
create table histogram_gap_bucket (
|
|
ts timestamp time index,
|
|
le string,
|
|
shard string,
|
|
val double,
|
|
primary key (shard, le)
|
|
) partition on columns (shard) (
|
|
shard < 'n',
|
|
shard >= 'n'
|
|
);
|
|
|
|
insert into histogram_gap_bucket values
|
|
(0, '0.5', 'a', 1),
|
|
(0, '1', 'a', 2),
|
|
(0, '+Inf', 'a', 2),
|
|
(0, '0.5', 'z', 2),
|
|
(0, '1', 'z', 4),
|
|
(0, '+Inf', 'z', 4),
|
|
(10000, '0.5', 'a', 1),
|
|
(10000, '1', 'a', 2),
|
|
(10000, '+Inf', 'a', 2),
|
|
(10000, '0.5', 'z', 1),
|
|
(10000, '1', 'z', 3),
|
|
(10000, '+Inf', 'z', 3);
|
|
|
|
-- Ensure the physical plan keeps the required repartition/order before folding buckets.
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE Hash\(\[ts@1\],.* Hash([ts@1],REDACTED
|
|
-- SQLNESS REPLACE Hash\(\[le@0,\sts@1\],.* Hash([le@0, ts@1],REDACTED
|
|
-- SQLNESS REPLACE \\?"(dyn_filters|time_range|file_summary|max_part_range)\\?":.* "$1":REDACTED
|
|
tql analyze (0, 10, '10s') histogram_quantile(0.5, sum by (le) (histogram_gap_bucket));
|
|
|
|
-- SQLNESS SORT_RESULT 2 1
|
|
tql eval (0, 10, '10s') histogram_quantile(0.5, sum by (le) (histogram_gap_bucket));
|
|
|
|
drop table histogram_gap_bucket;
|