mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-03 20:02:54 +00:00
* feat: add metrics for request wait time and adjust stall metrics (#6540) * feat: add metric greptime_mito_request_wait_time to observe wait time Signed-off-by: evenyag <realevenyag@gmail.com> * feat: add worker to wait time metric Signed-off-by: evenyag <realevenyag@gmail.com> * refactor: rename stall gauge to greptime_mito_write_stalling_count Signed-off-by: evenyag <realevenyag@gmail.com> * feat: change greptime_mito_write_stall_total to total stalled requests Signed-off-by: evenyag <realevenyag@gmail.com> * refactor: merge lazy static blocks Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> * fix: estimate mem size for bulk ingester (#6550) Signed-off-by: evenyag <realevenyag@gmail.com> * fix: flow mirror cache (#6551) * fix: invalid cache when flownode change address Signed-off-by: discord9 <discord9@163.com> * update comments Signed-off-by: discord9 <discord9@163.com> * fix Signed-off-by: discord9 <discord9@163.com> * refactor: add log&rename Signed-off-by: discord9 <discord9@163.com> * stuff Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> Signed-off-by: evenyag <realevenyag@gmail.com> * feat: impl timestamp function for promql (#6556) * feat: impl timestamp function for promql Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: style and typo Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: test Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * docs: update comments Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: comment Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> Signed-off-by: evenyag <realevenyag@gmail.com> * feat: MergeScan print input (#6563) * feat: MergeScan print input Signed-off-by: discord9 <discord9@163.com> * test: fix ut Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> Signed-off-by: evenyag <realevenyag@gmail.com> * fix: aggr group by all partition cols use partial commutative (#6534) * fix: aggr group by all partition cols use partial commutative Signed-off-by: discord9 <discord9@163.com> * test: bugged case Signed-off-by: discord9 <discord9@163.com> * test: sqlness fix Signed-off-by: discord9 <discord9@163.com> * test: more redacted Signed-off-by: discord9 <discord9@163.com> * more cases Signed-off-by: discord9 <discord9@163.com> * even more test cases Signed-off-by: discord9 <discord9@163.com> * join testcase Signed-off-by: discord9 <discord9@163.com> * fix: column requirement added in correct location Signed-off-by: discord9 <discord9@163.com> * fix test Signed-off-by: discord9 <discord9@163.com> * chore: clippy Signed-off-by: discord9 <discord9@163.com> * track col reqs per stack Signed-off-by: discord9 <discord9@163.com> * fix: continue Signed-off-by: discord9 <discord9@163.com> * chore: clippy Signed-off-by: discord9 <discord9@163.com> * refactor: test mod Signed-off-by: discord9 <discord9@163.com> * test utils Signed-off-by: discord9 <discord9@163.com> * test: better test Signed-off-by: discord9 <discord9@163.com> * more testcases Signed-off-by: discord9 <discord9@163.com> * test limit push down Signed-off-by: discord9 <discord9@163.com> * more testcases Signed-off-by: discord9 <discord9@163.com> * more testcase Signed-off-by: discord9 <discord9@163.com> * more test Signed-off-by: discord9 <discord9@163.com> * chore: update sqlness Signed-off-by: discord9 <discord9@163.com> * chore: update commnets Signed-off-by: discord9 <discord9@163.com> * fix: check col reqs from bottom to upper Signed-off-by: discord9 <discord9@163.com> * chore: more comment Signed-off-by: discord9 <discord9@163.com> * docs: more todo Signed-off-by: discord9 <discord9@163.com> * chore: comments Signed-off-by: discord9 <discord9@163.com> * test: a new failing test that should be fixed Signed-off-by: discord9 <discord9@163.com> * fix: part col alias tracking Signed-off-by: discord9 <discord9@163.com> * chore: unused Signed-off-by: discord9 <discord9@163.com> * chore: clippy Signed-off-by: discord9 <discord9@163.com> * docs: comment Signed-off-by: discord9 <discord9@163.com> * mroe testcase Signed-off-by: discord9 <discord9@163.com> * more testcase for step/part aggr combine Signed-off-by: discord9 <discord9@163.com> * FIXME: a new bug Signed-off-by: discord9 <discord9@163.com> * literally unfixable Signed-off-by: discord9 <discord9@163.com> * chore: remove some debug print Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> Signed-off-by: discord9 <discord9@163.com> Signed-off-by: Dennis Zhuang <killme2008@gmail.com> Co-authored-by: fys <40801205+fengys1996@users.noreply.github.com> Co-authored-by: discord9 <55937128+discord9@users.noreply.github.com> Co-authored-by: dennis zhuang <killme2008@gmail.com>
575 lines
23 KiB
Plaintext
575 lines
23 KiB
Plaintext
CREATE TABLE integers(
|
|
host STRING PRIMARY KEY,
|
|
i BIGINT,
|
|
ts TIMESTAMP TIME INDEX
|
|
) PARTITION ON COLUMNS (host) (
|
|
host < '550-A',
|
|
host >= '550-A'
|
|
AND host < '550-W',
|
|
host >= '550-W'
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO
|
|
integers (host, i, ts)
|
|
VALUES
|
|
('550-A', 1, '2023-01-01 00:00:00'),
|
|
('550-B', 5, '2023-01-01 00:00:00'),
|
|
('550-A', 2, '2023-01-01 01:00:00'),
|
|
('550-W', 3, '2023-01-01 02:00:00'),
|
|
('550-W', 4, '2023-01-01 03:00:00');
|
|
|
|
Affected Rows: 5
|
|
|
|
-- count
|
|
SELECT
|
|
count(i)
|
|
FROM
|
|
integers;
|
|
|
|
+-------------------+
|
|
| count(integers.i) |
|
|
+-------------------+
|
|
| 5 |
|
|
+-------------------+
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
EXPLAIN
|
|
SELECT
|
|
count(i)
|
|
FROM
|
|
integers;
|
|
|
|
+-+-+
|
|
| plan_type_| plan_|
|
|
+-+-+
|
|
| logical_plan_| Projection: sum(count(integers.i)) AS count(integers.i)_|
|
|
|_|_Aggregate: groupBy=[[]], aggr=[[sum(count(integers.i))]]_|
|
|
|_|_MergeScan [is_placeholder=false, remote_input=[_|
|
|
|_| Aggregate: groupBy=[[]], aggr=[[count(integers.i)]]_|
|
|
|_|_TableScan: integers_|
|
|
|_| ]]_|
|
|
| physical_plan | ProjectionExec: expr=[sum(count(integers.i))@0 as count(integers.i)]_|
|
|
|_|_AggregateExec: mode=Final, gby=[], aggr=[sum(count(integers.i))]_|
|
|
|_|_CoalescePartitionsExec_|
|
|
|_|_AggregateExec: mode=Partial, gby=[], aggr=[sum(count(integers.i))]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
+-+-+
|
|
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
EXPLAIN ANALYZE
|
|
SELECT
|
|
count(i)
|
|
FROM
|
|
integers;
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_ProjectionExec: expr=[sum(count(integers.i))@0 as count(integers.i)] REDACTED
|
|
|_|_|_AggregateExec: mode=Final, gby=[], aggr=[sum(count(integers.i))] REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[], aggr=[sum(count(integers.i))] REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_AggregateExec: mode=Final, gby=[], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_AggregateExec: mode=Final, gby=[], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 2_|_AggregateExec: mode=Final, gby=[], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 1_|
|
|
+-+-+-+
|
|
|
|
SELECT
|
|
ts,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
ts
|
|
ORDER BY
|
|
ts,
|
|
count(i);
|
|
|
|
+---------------------+-------------------+
|
|
| ts | count(integers.i) |
|
|
+---------------------+-------------------+
|
|
| 2023-01-01T00:00:00 | 2 |
|
|
| 2023-01-01T01:00:00 | 1 |
|
|
| 2023-01-01T02:00:00 | 1 |
|
|
| 2023-01-01T03:00:00 | 1 |
|
|
+---------------------+-------------------+
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
EXPLAIN
|
|
SELECT
|
|
ts,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
ts
|
|
ORDER BY
|
|
ts,
|
|
count(i);
|
|
|
|
+-+-+
|
|
| plan_type_| plan_|
|
|
+-+-+
|
|
| logical_plan_| Sort: integers.ts ASC NULLS LAST, count(integers.i) ASC NULLS LAST_|
|
|
|_|_Projection: integers.ts, sum(count(integers.i)) AS count(integers.i)_|
|
|
|_|_Aggregate: groupBy=[[integers.ts]], aggr=[[sum(count(integers.i))]]_|
|
|
|_|_MergeScan [is_placeholder=false, remote_input=[_|
|
|
|_| Aggregate: groupBy=[[integers.ts]], aggr=[[count(integers.i)]]_|
|
|
|_|_TableScan: integers_|
|
|
|_| ]]_|
|
|
| physical_plan | SortPreservingMergeExec: [ts@0 ASC NULLS LAST, count(integers.i)@1 ASC NULLS LAST]_|
|
|
|_|_SortExec: expr=[ts@0 ASC NULLS LAST, count(integers.i)@1 ASC NULLS LAST], preserve_partitioning=[true]_|
|
|
|_|_ProjectionExec: expr=[ts@0 as ts, sum(count(integers.i))@1 as count(integers.i)]_|
|
|
|_|_AggregateExec: mode=FinalPartitioned, gby=[ts@0 as ts], aggr=[sum(count(integers.i))]_|
|
|
|_|_CoalesceBatchesExec: target_batch_size=8192_|
|
|
|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_AggregateExec: mode=Partial, gby=[ts@0 as ts], aggr=[sum(count(integers.i))]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
+-+-+
|
|
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
EXPLAIN ANALYZE
|
|
SELECT
|
|
ts,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
ts
|
|
ORDER BY
|
|
ts,
|
|
count(i);
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_SortPreservingMergeExec: [ts@0 ASC NULLS LAST, count(integers.i)@1 ASC NULLS LAST] REDACTED
|
|
|_|_|_SortExec: expr=[ts@0 ASC NULLS LAST, count(integers.i)@1 ASC NULLS LAST], preserve_partitioning=[true] REDACTED
|
|
|_|_|_ProjectionExec: expr=[ts@0 as ts, sum(count(integers.i))@1 as count(integers.i)] REDACTED
|
|
|_|_|_AggregateExec: mode=FinalPartitioned, gby=[ts@0 as ts], aggr=[sum(count(integers.i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[ts@0 as ts], aggr=[sum(count(integers.i))] REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_AggregateExec: mode=FinalPartitioned, gby=[ts@0 as ts], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[ts@1 as ts], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_AggregateExec: mode=FinalPartitioned, gby=[ts@0 as ts], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[ts@1 as ts], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 2_|_AggregateExec: mode=FinalPartitioned, gby=[ts@0 as ts], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[ts@1 as ts], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 4_|
|
|
+-+-+-+
|
|
|
|
SELECT
|
|
date_bin('1 hour' :: INTERVAL, ts) as time_window,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
time_window
|
|
ORDER BY
|
|
time_window,
|
|
count(i);
|
|
|
|
+---------------------+-------------------+
|
|
| time_window | count(integers.i) |
|
|
+---------------------+-------------------+
|
|
| 2023-01-01T00:00:00 | 2 |
|
|
| 2023-01-01T01:00:00 | 1 |
|
|
| 2023-01-01T02:00:00 | 1 |
|
|
| 2023-01-01T03:00:00 | 1 |
|
|
+---------------------+-------------------+
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
EXPLAIN
|
|
SELECT
|
|
date_bin('1 hour' :: INTERVAL, ts) as time_window,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
time_window
|
|
ORDER BY
|
|
time_window,
|
|
count(i);
|
|
|
|
+-+-+
|
|
| plan_type_| plan_|
|
|
+-+-+
|
|
| logical_plan_| Sort: time_window ASC NULLS LAST, count(integers.i) ASC NULLS LAST_|
|
|
|_|_Projection: date_bin(Utf8("1 hour"),integers.ts) AS time_window, sum(count(integers.i)) AS count(integers.i)_|
|
|
|_|_Aggregate: groupBy=[[date_bin(Utf8("1 hour"),integers.ts)]], aggr=[[sum(count(integers.i))]]_|
|
|
|_|_MergeScan [is_placeholder=false, remote_input=[_|
|
|
|_| Aggregate: groupBy=[[date_bin(CAST(Utf8("1 hour") AS Interval(MonthDayNano)), integers.ts)]], aggr=[[count(integers.i)]]_|
|
|
|_|_TableScan: integers_|
|
|
|_| ]]_|
|
|
| physical_plan | SortPreservingMergeExec: [time_window@0 ASC NULLS LAST, count(integers.i)@1 ASC NULLS LAST]_|
|
|
|_|_SortExec: expr=[time_window@0 ASC NULLS LAST, count(integers.i)@1 ASC NULLS LAST], preserve_partitioning=[true]_|
|
|
|_|_ProjectionExec: expr=[date_bin(Utf8("1 hour"),integers.ts)@0 as time_window, sum(count(integers.i))@1 as count(integers.i)]_|
|
|
|_|_AggregateExec: mode=FinalPartitioned, gby=[date_bin(Utf8("1 hour"),integers.ts)@0 as date_bin(Utf8("1 hour"),integers.ts)], aggr=[sum(count(integers.i))] |
|
|
|_|_CoalesceBatchesExec: target_batch_size=8192_|
|
|
|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_AggregateExec: mode=Partial, gby=[date_bin(Utf8("1 hour"),integers.ts)@0 as date_bin(Utf8("1 hour"),integers.ts)], aggr=[sum(count(integers.i))]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
+-+-+
|
|
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
EXPLAIN ANALYZE
|
|
SELECT
|
|
date_bin('1 hour' :: INTERVAL, ts) as time_window,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
time_window
|
|
ORDER BY
|
|
time_window,
|
|
count(i);
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_SortPreservingMergeExec: [time_window@0 ASC NULLS LAST, count(integers.i)@1 ASC NULLS LAST] REDACTED
|
|
|_|_|_SortExec: expr=[time_window@0 ASC NULLS LAST, count(integers.i)@1 ASC NULLS LAST], preserve_partitioning=[true] REDACTED
|
|
|_|_|_ProjectionExec: expr=[date_bin(Utf8("1 hour"),integers.ts)@0 as time_window, sum(count(integers.i))@1 as count(integers.i)] REDACTED
|
|
|_|_|_AggregateExec: mode=FinalPartitioned, gby=[date_bin(Utf8("1 hour"),integers.ts)@0 as date_bin(Utf8("1 hour"),integers.ts)], aggr=[sum(count(integers.i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[date_bin(Utf8("1 hour"),integers.ts)@0 as date_bin(Utf8("1 hour"),integers.ts)], aggr=[sum(count(integers.i))] REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_AggregateExec: mode=FinalPartitioned, gby=[date_bin(Utf8("1 hour"),integers.ts)@0 as date_bin(Utf8("1 hour"),integers.ts)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[date_bin(IntervalMonthDayNano { months: 0, days: 0, nanoseconds: 3600000000000 }, ts@1) as date_bin(Utf8("1 hour"),integers.ts)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_AggregateExec: mode=FinalPartitioned, gby=[date_bin(Utf8("1 hour"),integers.ts)@0 as date_bin(Utf8("1 hour"),integers.ts)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[date_bin(IntervalMonthDayNano { months: 0, days: 0, nanoseconds: 3600000000000 }, ts@1) as date_bin(Utf8("1 hour"),integers.ts)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 2_|_AggregateExec: mode=FinalPartitioned, gby=[date_bin(Utf8("1 hour"),integers.ts)@0 as date_bin(Utf8("1 hour"),integers.ts)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[date_bin(IntervalMonthDayNano { months: 0, days: 0, nanoseconds: 3600000000000 }, ts@1) as date_bin(Utf8("1 hour"),integers.ts)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 4_|
|
|
+-+-+-+
|
|
|
|
SELECT
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
ORDER BY
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
;
|
|
|
|
+------------------------+-----------------------+-------------------+
|
|
| integers.ts + Int64(1) | integers.i / Int64(2) | count(integers.i) |
|
|
+------------------------+-----------------------+-------------------+
|
|
| 1672531200001 | 0 | 1 |
|
|
| 1672531200001 | 2 | 1 |
|
|
| 1672534800001 | 1 | 1 |
|
|
| 1672538400001 | 1 | 1 |
|
|
| 1672542000001 | 2 | 1 |
|
|
+------------------------+-----------------------+-------------------+
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
EXPLAIN
|
|
SELECT
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
ORDER BY
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
;
|
|
|
|
+-+-+
|
|
| plan_type_| plan_|
|
|
+-+-+
|
|
| logical_plan_| Sort: integers.ts + Int64(1) ASC NULLS LAST, integers.i / Int64(2) ASC NULLS LAST_|
|
|
|_|_Projection: integers.ts + Int64(1), integers.i / Int64(2), sum(count(integers.i)) AS count(integers.i)_|
|
|
|_|_Aggregate: groupBy=[[integers.ts + Int64(1), integers.i / Int64(2)]], aggr=[[sum(count(integers.i))]]_|
|
|
|_|_MergeScan [is_placeholder=false, remote_input=[_|
|
|
|_| Aggregate: groupBy=[[CAST(integers.ts AS Int64) + Int64(1), integers.i / Int64(2)]], aggr=[[count(integers.i)]]_|
|
|
|_|_TableScan: integers_|
|
|
|_| ]]_|
|
|
| physical_plan | SortPreservingMergeExec: [integers.ts + Int64(1)@0 ASC NULLS LAST, integers.i / Int64(2)@1 ASC NULLS LAST]_|
|
|
|_|_SortExec: expr=[integers.ts + Int64(1)@0 ASC NULLS LAST, integers.i / Int64(2)@1 ASC NULLS LAST], preserve_partitioning=[true]_|
|
|
|_|_ProjectionExec: expr=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2), sum(count(integers.i))@2 as count(integers.i)]_|
|
|
|_|_AggregateExec: mode=FinalPartitioned, gby=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2)], aggr=[sum(count(integers.i))] |
|
|
|_|_CoalesceBatchesExec: target_batch_size=8192_|
|
|
|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_AggregateExec: mode=Partial, gby=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2)], aggr=[sum(count(integers.i))]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
+-+-+
|
|
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
EXPLAIN ANALYZE
|
|
SELECT
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
count(i)
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
ORDER BY
|
|
ts::BIGINT + 1,
|
|
i / 2,
|
|
;
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_SortPreservingMergeExec: [integers.ts + Int64(1)@0 ASC NULLS LAST, integers.i / Int64(2)@1 ASC NULLS LAST] REDACTED
|
|
|_|_|_SortExec: expr=[integers.ts + Int64(1)@0 ASC NULLS LAST, integers.i / Int64(2)@1 ASC NULLS LAST], preserve_partitioning=[true] REDACTED
|
|
|_|_|_ProjectionExec: expr=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2), sum(count(integers.i))@2 as count(integers.i)] REDACTED
|
|
|_|_|_AggregateExec: mode=FinalPartitioned, gby=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2)], aggr=[sum(count(integers.i))] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2)], aggr=[sum(count(integers.i))] REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_AggregateExec: mode=FinalPartitioned, gby=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[CAST(ts@1 AS Int64) + 1 as integers.ts + Int64(1), i@0 / 2 as integers.i / Int64(2)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_AggregateExec: mode=FinalPartitioned, gby=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[CAST(ts@1 AS Int64) + 1 as integers.ts + Int64(1), i@0 / 2 as integers.i / Int64(2)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 2_|_AggregateExec: mode=FinalPartitioned, gby=[integers.ts + Int64(1)@0 as integers.ts + Int64(1), integers.i / Int64(2)@1 as integers.i / Int64(2)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
|
|_|_|_RepartitionExec: partitioning=REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[CAST(ts@1 AS Int64) + 1 as integers.ts + Int64(1), i@0 / 2 as integers.i / Int64(2)], aggr=[count(integers.i)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 5_|
|
|
+-+-+-+
|
|
|
|
-- test udd/hll_merege pushdown
|
|
CREATE TABLE sink_table (
|
|
time_window TIMESTAMP TIME INDEX,
|
|
host STRING PRIMARY KEY,
|
|
udd_state BINARY,
|
|
hll_state BINARY,
|
|
) PARTITION ON COLUMNS (host) (
|
|
host < '550-A',
|
|
host >= '550-A'
|
|
AND host < '550-W',
|
|
host >= '550-W'
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO
|
|
sink_table
|
|
SELECT
|
|
date_bin('1 hour' :: INTERVAL, ts) as time_window,
|
|
host,
|
|
uddsketch_state(128, 0.01, i) as udd_state,
|
|
hll(i) as hll_state
|
|
FROM
|
|
integers
|
|
GROUP BY
|
|
time_window,
|
|
host;
|
|
|
|
Affected Rows: 5
|
|
|
|
SELECT
|
|
uddsketch_calc(0.5, uddsketch_merge(128, 0.01, udd_state)) as udd_result,
|
|
hll_count(hll_merge(hll_state)) as hll_result
|
|
FROM
|
|
sink_table;
|
|
|
|
+--------------------+------------+
|
|
| udd_result | hll_result |
|
|
+--------------------+------------+
|
|
| 2.9742334234767016 | 5 |
|
|
+--------------------+------------+
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
EXPLAIN
|
|
SELECT
|
|
uddsketch_calc(0.5, uddsketch_merge(128, 0.01, udd_state)) as udd_result,
|
|
hll_count(hll_merge(hll_state)) as hll_result
|
|
FROM
|
|
sink_table;
|
|
|
|
+-+-+
|
|
| plan_type_| plan_|
|
|
+-+-+
|
|
| logical_plan_| Projection: uddsketch_calc(Float64(0.5), uddsketch_merge(Int64(128),Float64(0.01),uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state))) AS udd_result, hll_count(hll_merge(hll_merge(sink_table.hll_state))) AS hll_result_|
|
|
|_|_Aggregate: groupBy=[[]], aggr=[[uddsketch_merge(Int64(128), Float64(0.01), uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state)), hll_merge(hll_merge(sink_table.hll_state))]]_|
|
|
|_|_MergeScan [is_placeholder=false, remote_input=[_|
|
|
|_| Aggregate: groupBy=[[]], aggr=[[uddsketch_merge(Int64(128), Float64(0.01), sink_table.udd_state), hll_merge(sink_table.hll_state)]]_|
|
|
|_|_TableScan: sink_table_|
|
|
|_| ]]_|
|
|
| physical_plan | ProjectionExec: expr=[uddsketch_calc(0.5, uddsketch_merge(Int64(128),Float64(0.01),uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state))@0) as udd_result, hll_count(hll_merge(hll_merge(sink_table.hll_state))@1) as hll_result] |
|
|
|_|_AggregateExec: mode=Final, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state)), hll_merge(hll_merge(sink_table.hll_state))]_|
|
|
|_|_CoalescePartitionsExec_|
|
|
|_|_AggregateExec: mode=Partial, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state)), hll_merge(hll_merge(sink_table.hll_state))]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
+-+-+
|
|
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
-- SQLNESS REPLACE (Hash.*) REDACTED
|
|
EXPLAIN ANALYZE
|
|
SELECT
|
|
uddsketch_calc(0.5, uddsketch_merge(128, 0.01, udd_state)) as udd_result,
|
|
hll_count(hll_merge(hll_state)) as hll_result
|
|
FROM
|
|
sink_table;
|
|
|
|
+-+-+-+
|
|
| stage | node | plan_|
|
|
+-+-+-+
|
|
| 0_| 0_|_ProjectionExec: expr=[uddsketch_calc(0.5, uddsketch_merge(Int64(128),Float64(0.01),uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state))@0) as udd_result, hll_count(hll_merge(hll_merge(sink_table.hll_state))@1) as hll_result] REDACTED
|
|
|_|_|_AggregateExec: mode=Final, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state)), hll_merge(hll_merge(sink_table.hll_state))] REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state)), hll_merge(hll_merge(sink_table.hll_state))] REDACTED
|
|
|_|_|_MergeScanExec: REDACTED
|
|
|_|_|_|
|
|
| 1_| 0_|_AggregateExec: mode=Final, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state), hll_merge(sink_table.hll_state)] REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state), hll_merge(sink_table.hll_state)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 1_|_AggregateExec: mode=Final, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state), hll_merge(sink_table.hll_state)] REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state), hll_merge(sink_table.hll_state)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
| 1_| 2_|_AggregateExec: mode=Final, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state), hll_merge(sink_table.hll_state)] REDACTED
|
|
|_|_|_CoalescePartitionsExec REDACTED
|
|
|_|_|_AggregateExec: mode=Partial, gby=[], aggr=[uddsketch_merge(Int64(128),Float64(0.01),sink_table.udd_state), hll_merge(sink_table.hll_state)] REDACTED
|
|
|_|_|_SeqScan: region=REDACTED, "partition_count":REDACTED REDACTED
|
|
|_|_|_|
|
|
|_|_| Total rows: 1_|
|
|
+-+-+-+
|
|
|
|
DROP TABLE integers;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE sink_table;
|
|
|
|
Affected Rows: 0
|
|
|