feat: time series distribution in scanner (#5675)

* define distribution

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* feat: SeqScan support per series distribution

* probe distribution

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* reverse sort order

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* more strict check

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix clippy

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* change null's ordering

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: evenyag <realevenyag@gmail.com>
This commit is contained in:
Ruihang Xia
2025-03-09 22:43:17 -07:00
committed by GitHub
parent 0acc6b0354
commit 73ca39f37e
16 changed files with 426 additions and 43 deletions

View File

@@ -316,3 +316,63 @@ drop table t;
Affected Rows: 0
-- ORDER BY with projections
CREATE TABLE test (
c1 INTEGER,
c2 INTEGER,
c3 STRING,
c4 DOUBLE,
ts TIMESTAMP TIME INDEX,
PRIMARY KEY (c1, c3, c2)
);
Affected Rows: 0
INSERT INTO test VALUES (1, NULL, 'a', 3.0, 1), (2, 3, 'b', 4.0, 2), (3, 4, 'c', 5.0, 3);
Affected Rows: 3
SELECT c1, c3 FROM test ORDER BY c2;
+----+----+
| c1 | c3 |
+----+----+
| 2 | b |
| 3 | c |
| 1 | a |
+----+----+
SELECT c1, c3 FROM test ORDER BY c2 NULLS FIRST;
+----+----+
| c1 | c3 |
+----+----+
| 1 | a |
| 2 | b |
| 3 | c |
+----+----+
SELECT c1, c3 FROM test ORDER BY c3, c1;
+----+----+
| c1 | c3 |
+----+----+
| 1 | a |
| 2 | b |
| 3 | c |
+----+----+
SELECT c2 FROM test ORDER BY ts;
+----+
| c2 |
+----+
| |
| 3 |
| 4 |
+----+
drop table test;
Affected Rows: 0

View File

@@ -97,3 +97,26 @@ select tag from t where num > 6 order by ts;
explain analyze select tag from t where num > 6 order by ts desc limit 2;
drop table t;
-- ORDER BY with projections
CREATE TABLE test (
c1 INTEGER,
c2 INTEGER,
c3 STRING,
c4 DOUBLE,
ts TIMESTAMP TIME INDEX,
PRIMARY KEY (c1, c3, c2)
);
INSERT INTO test VALUES (1, NULL, 'a', 3.0, 1), (2, 3, 'b', 4.0, 2), (3, 4, 'c', 5.0, 3);
SELECT c1, c3 FROM test ORDER BY c2;
SELECT c1, c3 FROM test ORDER BY c2 NULLS FIRST;
SELECT c1, c3 FROM test ORDER BY c3, c1;
SELECT c2 FROM test ORDER BY ts;
drop table test;