test: add sqlness for delete and filter (#7171)

Signed-off-by: evenyag <realevenyag@gmail.com>
This commit is contained in:
Yingwen
2025-11-04 10:13:47 +08:00
committed by GitHub
parent 013d61acbb
commit d944e5c6b8
2 changed files with 78 additions and 0 deletions

View File

@@ -35,18 +35,82 @@ DELETE FROM monitor WHERE host = 'host1' AND ts = 1655276557000::timestamp;
Affected Rows: 1
SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
+---------------------+-------+------+--------+
| ts | host | cpu | memory |
+---------------------+-------+------+--------+
| 2022-06-15T07:02:37 | host2 | 66.6 | 1024.0 |
| 2022-06-15T07:02:37 | host3 | 66.6 | 1024.0 |
| 2022-06-15T07:02:38 | host1 | 77.7 | 2048.0 |
| 2022-06-15T07:02:38 | host2 | 77.7 | 2048.0 |
| 2022-06-15T07:02:38 | host3 | 77.7 | 2048.0 |
| 2022-06-15T07:02:39 | host1 | 88.8 | 4096.0 |
| 2022-06-15T07:02:39 | host2 | 88.8 | 4096.0 |
| 2022-06-15T07:02:39 | host3 | 88.8 | 4096.0 |
+---------------------+-------+------+--------+
DELETE FROM monitor WHERE host = 'host2';
Affected Rows: 3
ADMIN flush_table('monitor');
+------------------------------+
| ADMIN flush_table('monitor') |
+------------------------------+
| 0 |
+------------------------------+
SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
+---------------------+-------+------+--------+
| ts | host | cpu | memory |
+---------------------+-------+------+--------+
| 2022-06-15T07:02:37 | host3 | 66.6 | 1024.0 |
| 2022-06-15T07:02:38 | host1 | 77.7 | 2048.0 |
| 2022-06-15T07:02:38 | host3 | 77.7 | 2048.0 |
| 2022-06-15T07:02:39 | host1 | 88.8 | 4096.0 |
| 2022-06-15T07:02:39 | host3 | 88.8 | 4096.0 |
+---------------------+-------+------+--------+
DELETE FROM monitor WHERE cpu = 66.6;
Affected Rows: 1
ADMIN flush_table('monitor');
+------------------------------+
| ADMIN flush_table('monitor') |
+------------------------------+
| 0 |
+------------------------------+
SELECT ts, host, cpu, memory FROM monitor WHERE cpu = 66.6 ORDER BY ts;
++
++
SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
+---------------------+-------+------+--------+
| ts | host | cpu | memory |
+---------------------+-------+------+--------+
| 2022-06-15T07:02:38 | host1 | 77.7 | 2048.0 |
| 2022-06-15T07:02:38 | host3 | 77.7 | 2048.0 |
| 2022-06-15T07:02:39 | host1 | 88.8 | 4096.0 |
| 2022-06-15T07:02:39 | host3 | 88.8 | 4096.0 |
+---------------------+-------+------+--------+
DELETE FROM monitor WHERE memory > 2048;
Affected Rows: 2
SELECT ts, host, cpu, memory FROM monitor WHERE memory > 2048 ORDER BY ts;
++
++
SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
+---------------------+-------+------+--------+

View File

@@ -15,12 +15,26 @@ SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
DELETE FROM monitor WHERE host = 'host1' AND ts = 1655276557000::timestamp;
SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
DELETE FROM monitor WHERE host = 'host2';
ADMIN flush_table('monitor');
SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
DELETE FROM monitor WHERE cpu = 66.6;
ADMIN flush_table('monitor');
SELECT ts, host, cpu, memory FROM monitor WHERE cpu = 66.6 ORDER BY ts;
SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
DELETE FROM monitor WHERE memory > 2048;
SELECT ts, host, cpu, memory FROM monitor WHERE memory > 2048 ORDER BY ts;
SELECT ts, host, cpu, memory FROM monitor ORDER BY ts;
DROP TABLE monitor;