mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-15 12:30:38 +00:00
79
tests/cases/distributed/optimizer/windowed_sort_nanos.result
Normal file
79
tests/cases/distributed/optimizer/windowed_sort_nanos.result
Normal file
@@ -0,0 +1,79 @@
|
||||
create table `a_ms` (`value` double, `status` bigint, ts timestamp(3) time index);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO `a_ms` (`value`, `status`, `ts`) VALUES
|
||||
(46.82, 200, '2026-03-12T08:00:05.123+08:00'),
|
||||
(46.84, 200, '2026-03-12T08:00:15.234+08:00'),
|
||||
(46.85, 200, '2026-03-12T08:00:25.345+08:00'),
|
||||
(46.86, 200, '2026-03-12T08:00:35.456+08:00'),
|
||||
(46.88, 200, '2026-03-12T08:00:45.567+08:00'),
|
||||
(46.89, 200, '2026-03-12T08:00:55.678+08:00'),
|
||||
(46.91, 200, '2026-03-12T08:01:05.789+08:00'),
|
||||
(46.90, 200, '2026-03-12T08:01:15.890+08:00'),
|
||||
(46.87, 200, '2026-03-12T08:01:25.901+08:00'),
|
||||
(46.85, 200, '2026-03-12T08:01:35.999+08:00');
|
||||
|
||||
Affected Rows: 10
|
||||
|
||||
select ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
+-------------------------+--------+-------+
|
||||
| ts | status | value |
|
||||
+-------------------------+--------+-------+
|
||||
| 2026-03-12T00:00:05.123 | 200 | 46.82 |
|
||||
| 2026-03-12T00:00:15.234 | 200 | 46.84 |
|
||||
| 2026-03-12T00:00:25.345 | 200 | 46.85 |
|
||||
| 2026-03-12T00:00:35.456 | 200 | 46.86 |
|
||||
| 2026-03-12T00:00:45.567 | 200 | 46.88 |
|
||||
| 2026-03-12T00:00:55.678 | 200 | 46.89 |
|
||||
| 2026-03-12T00:01:05.789 | 200 | 46.91 |
|
||||
| 2026-03-12T00:01:15.890 | 200 | 46.9 |
|
||||
| 2026-03-12T00:01:25.901 | 200 | 46.87 |
|
||||
| 2026-03-12T00:01:35.999 | 200 | 46.85 |
|
||||
+-------------------------+--------+-------+
|
||||
|
||||
select to_timestamp_nanos(ts) as ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
+-------------------------+--------+-------+
|
||||
| ts | status | value |
|
||||
+-------------------------+--------+-------+
|
||||
| 2026-03-12T00:00:05.123 | 200 | 46.82 |
|
||||
| 2026-03-12T00:00:15.234 | 200 | 46.84 |
|
||||
| 2026-03-12T00:00:25.345 | 200 | 46.85 |
|
||||
| 2026-03-12T00:00:35.456 | 200 | 46.86 |
|
||||
| 2026-03-12T00:00:45.567 | 200 | 46.88 |
|
||||
| 2026-03-12T00:00:55.678 | 200 | 46.89 |
|
||||
| 2026-03-12T00:01:05.789 | 200 | 46.91 |
|
||||
| 2026-03-12T00:01:15.890 | 200 | 46.9 |
|
||||
| 2026-03-12T00:01:25.901 | 200 | 46.87 |
|
||||
| 2026-03-12T00:01:35.999 | 200 | 46.85 |
|
||||
+-------------------------+--------+-------+
|
||||
|
||||
-- SQLNESS REPLACE (-+) -
|
||||
-- SQLNESS REPLACE (\s\s+) _
|
||||
-- SQLNESS REPLACE (peers.*) REDACTED
|
||||
-- SQLNESS REPLACE (metrics.*) REDACTED
|
||||
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
||||
-- SQLNESS REPLACE num_ranges=\d+ num_ranges=REDACTED
|
||||
EXPLAIN ANALYZE select to_timestamp_nanos(ts) as ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
+-+-+-+
|
||||
| stage | node | plan_|
|
||||
+-+-+-+
|
||||
| 0_| 0_|_CooperativeExec REDACTED
|
||||
|_|_|_MergeScanExec: REDACTED
|
||||
|_|_|_|
|
||||
| 1_| 0_|_ProjectionExec: expr=[to_timestamp_nanos(a_ms.ts)@0 as ts, status@1 as status, value@2 as value] REDACTED
|
||||
|_|_|_SortPreservingMergeExec: [to_timestamp_nanos(a_ms.ts)@0 ASC NULLS LAST] REDACTED
|
||||
|_|_|_WindowedSortExec: expr=to_timestamp_nanos(a_ms.ts)@0 ASC NULLS LAST num_ranges=REDACTED REDACTED
|
||||
|_|_|_ProjectionExec: expr=[to_timestamp_nanos(ts@2) as to_timestamp_nanos(a_ms.ts), status@1 as status, value@0 as value] REDACTED
|
||||
|_|_|_SeqScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0} REDACTED
|
||||
|_|_|_|
|
||||
|_|_| Total rows: 10_|
|
||||
+-+-+-+
|
||||
|
||||
DROP TABLE `a_ms`;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
27
tests/cases/distributed/optimizer/windowed_sort_nanos.sql
Normal file
27
tests/cases/distributed/optimizer/windowed_sort_nanos.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
create table `a_ms` (`value` double, `status` bigint, ts timestamp(3) time index);
|
||||
|
||||
INSERT INTO `a_ms` (`value`, `status`, `ts`) VALUES
|
||||
(46.82, 200, '2026-03-12T08:00:05.123+08:00'),
|
||||
(46.84, 200, '2026-03-12T08:00:15.234+08:00'),
|
||||
(46.85, 200, '2026-03-12T08:00:25.345+08:00'),
|
||||
(46.86, 200, '2026-03-12T08:00:35.456+08:00'),
|
||||
(46.88, 200, '2026-03-12T08:00:45.567+08:00'),
|
||||
(46.89, 200, '2026-03-12T08:00:55.678+08:00'),
|
||||
(46.91, 200, '2026-03-12T08:01:05.789+08:00'),
|
||||
(46.90, 200, '2026-03-12T08:01:15.890+08:00'),
|
||||
(46.87, 200, '2026-03-12T08:01:25.901+08:00'),
|
||||
(46.85, 200, '2026-03-12T08:01:35.999+08:00');
|
||||
|
||||
select ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
select to_timestamp_nanos(ts) as ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
-- SQLNESS REPLACE (-+) -
|
||||
-- SQLNESS REPLACE (\s\s+) _
|
||||
-- SQLNESS REPLACE (peers.*) REDACTED
|
||||
-- SQLNESS REPLACE (metrics.*) REDACTED
|
||||
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
||||
-- SQLNESS REPLACE num_ranges=\d+ num_ranges=REDACTED
|
||||
EXPLAIN ANALYZE select to_timestamp_nanos(ts) as ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
DROP TABLE `a_ms`;
|
||||
78
tests/cases/standalone/optimizer/windowed_sort_nanos.result
Normal file
78
tests/cases/standalone/optimizer/windowed_sort_nanos.result
Normal file
@@ -0,0 +1,78 @@
|
||||
create table `a_ms` (`value` double, `status` bigint, ts timestamp(3) time index);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO `a_ms` (`value`, `status`, `ts`) VALUES
|
||||
(46.82, 200, '2026-03-12T08:00:05.123+08:00'),
|
||||
(46.84, 200, '2026-03-12T08:00:15.234+08:00'),
|
||||
(46.85, 200, '2026-03-12T08:00:25.345+08:00'),
|
||||
(46.86, 200, '2026-03-12T08:00:35.456+08:00'),
|
||||
(46.88, 200, '2026-03-12T08:00:45.567+08:00'),
|
||||
(46.89, 200, '2026-03-12T08:00:55.678+08:00'),
|
||||
(46.91, 200, '2026-03-12T08:01:05.789+08:00'),
|
||||
(46.90, 200, '2026-03-12T08:01:15.890+08:00'),
|
||||
(46.87, 200, '2026-03-12T08:01:25.901+08:00'),
|
||||
(46.85, 200, '2026-03-12T08:01:35.999+08:00');
|
||||
|
||||
Affected Rows: 10
|
||||
|
||||
select ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
+-------------------------+--------+-------+
|
||||
| ts | status | value |
|
||||
+-------------------------+--------+-------+
|
||||
| 2026-03-12T00:00:05.123 | 200 | 46.82 |
|
||||
| 2026-03-12T00:00:15.234 | 200 | 46.84 |
|
||||
| 2026-03-12T00:00:25.345 | 200 | 46.85 |
|
||||
| 2026-03-12T00:00:35.456 | 200 | 46.86 |
|
||||
| 2026-03-12T00:00:45.567 | 200 | 46.88 |
|
||||
| 2026-03-12T00:00:55.678 | 200 | 46.89 |
|
||||
| 2026-03-12T00:01:05.789 | 200 | 46.91 |
|
||||
| 2026-03-12T00:01:15.890 | 200 | 46.9 |
|
||||
| 2026-03-12T00:01:25.901 | 200 | 46.87 |
|
||||
| 2026-03-12T00:01:35.999 | 200 | 46.85 |
|
||||
+-------------------------+--------+-------+
|
||||
|
||||
select to_timestamp_nanos(ts) as ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
+-------------------------+--------+-------+
|
||||
| ts | status | value |
|
||||
+-------------------------+--------+-------+
|
||||
| 2026-03-12T00:00:05.123 | 200 | 46.82 |
|
||||
| 2026-03-12T00:00:15.234 | 200 | 46.84 |
|
||||
| 2026-03-12T00:00:25.345 | 200 | 46.85 |
|
||||
| 2026-03-12T00:00:35.456 | 200 | 46.86 |
|
||||
| 2026-03-12T00:00:45.567 | 200 | 46.88 |
|
||||
| 2026-03-12T00:00:55.678 | 200 | 46.89 |
|
||||
| 2026-03-12T00:01:05.789 | 200 | 46.91 |
|
||||
| 2026-03-12T00:01:15.890 | 200 | 46.9 |
|
||||
| 2026-03-12T00:01:25.901 | 200 | 46.87 |
|
||||
| 2026-03-12T00:01:35.999 | 200 | 46.85 |
|
||||
+-------------------------+--------+-------+
|
||||
|
||||
-- SQLNESS REPLACE (-+) -
|
||||
-- SQLNESS REPLACE (\s\s+) _
|
||||
-- SQLNESS REPLACE (peers.*) REDACTED
|
||||
-- SQLNESS REPLACE (metrics.*) REDACTED
|
||||
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
||||
-- SQLNESS REPLACE num_ranges=\d+ num_ranges=REDACTED
|
||||
EXPLAIN ANALYZE select to_timestamp_nanos(ts) as ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
+-+-+-+
|
||||
| stage | node | plan_|
|
||||
+-+-+-+
|
||||
| 0_| 0_|_CooperativeExec REDACTED
|
||||
|_|_|_MergeScanExec: REDACTED
|
||||
|_|_|_|
|
||||
| 1_| 0_|_SortPreservingMergeExec: [ts@0 ASC NULLS LAST] REDACTED
|
||||
|_|_|_WindowedSortExec: expr=ts@0 ASC NULLS LAST num_ranges=REDACTED REDACTED
|
||||
|_|_|_ProjectionExec: expr=[to_timestamp_nanos(ts@2) as ts, status@1 as status, value@0 as value] REDACTED
|
||||
|_|_|_SeqScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0} REDACTED
|
||||
|_|_|_|
|
||||
|_|_| Total rows: 10_|
|
||||
+-+-+-+
|
||||
|
||||
DROP TABLE `a_ms`;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
27
tests/cases/standalone/optimizer/windowed_sort_nanos.sql
Normal file
27
tests/cases/standalone/optimizer/windowed_sort_nanos.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
create table `a_ms` (`value` double, `status` bigint, ts timestamp(3) time index);
|
||||
|
||||
INSERT INTO `a_ms` (`value`, `status`, `ts`) VALUES
|
||||
(46.82, 200, '2026-03-12T08:00:05.123+08:00'),
|
||||
(46.84, 200, '2026-03-12T08:00:15.234+08:00'),
|
||||
(46.85, 200, '2026-03-12T08:00:25.345+08:00'),
|
||||
(46.86, 200, '2026-03-12T08:00:35.456+08:00'),
|
||||
(46.88, 200, '2026-03-12T08:00:45.567+08:00'),
|
||||
(46.89, 200, '2026-03-12T08:00:55.678+08:00'),
|
||||
(46.91, 200, '2026-03-12T08:01:05.789+08:00'),
|
||||
(46.90, 200, '2026-03-12T08:01:15.890+08:00'),
|
||||
(46.87, 200, '2026-03-12T08:01:25.901+08:00'),
|
||||
(46.85, 200, '2026-03-12T08:01:35.999+08:00');
|
||||
|
||||
select ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
select to_timestamp_nanos(ts) as ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
-- SQLNESS REPLACE (-+) -
|
||||
-- SQLNESS REPLACE (\s\s+) _
|
||||
-- SQLNESS REPLACE (peers.*) REDACTED
|
||||
-- SQLNESS REPLACE (metrics.*) REDACTED
|
||||
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
||||
-- SQLNESS REPLACE num_ranges=\d+ num_ranges=REDACTED
|
||||
EXPLAIN ANALYZE select to_timestamp_nanos(ts) as ts, status, value from `a_ms` where ts >= '2026-03-12T08:00:00.000+08:00' and ts < '2026-03-12T08:02:01.000+08:00' order by ts asc;
|
||||
|
||||
DROP TABLE `a_ms`;
|
||||
Reference in New Issue
Block a user