Skip to content

Commit

Permalink
tests: sqlness
Browse files Browse the repository at this point in the history
  • Loading branch information
discord9 committed Dec 5, 2024
1 parent ec321d6 commit c5186dd
Show file tree
Hide file tree
Showing 4 changed files with 360 additions and 15 deletions.
254 changes: 246 additions & 8 deletions tests/cases/standalone/common/ttl/ttl_instant.result
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
CREATE TABLE test_ttl(ts TIMESTAMP TIME INDEX, val INT) WITH (ttl = 'instant');
CREATE TABLE test_ttl(
ts TIMESTAMP TIME INDEX,
val INT,
PRIMARY KEY (`val`)
) WITH (ttl = 'instant');

Affected Rows: 0

Expand All @@ -10,7 +14,8 @@ SHOW CREATE TABLE test_ttl;
| test_ttl | CREATE TABLE IF NOT EXISTS "test_ttl" ( |
| | "ts" TIMESTAMP(3) NOT NULL, |
| | "val" INT NULL, |
| | TIME INDEX ("ts") |
| | TIME INDEX ("ts"), |
| | PRIMARY KEY ("val") |
| | ) |
| | |
| | ENGINE=mito |
Expand All @@ -24,9 +29,7 @@ INSERT INTO
VALUES
(now(), 1),
(now(), 2),
(now(), 3),
(now() + INTERVAL '1 SECOND', 4),
(now() - INTERVAL '1 SECOND', 5);
(now(), 3);

Affected Rows: 0

Expand All @@ -38,17 +41,252 @@ from
++
++

-- SQLNESS SLEEP 2s
ADMIN flush_table('test_ttl');

+-------------------------------+
| ADMIN flush_table('test_ttl') |
+-------------------------------+
| 0 |
+-------------------------------+

ADMIN compact_table('test_ttl');

+---------------------------------+
| ADMIN compact_table('test_ttl') |
+---------------------------------+
| 0 |
+---------------------------------+

SELECT
val
from
test_ttl;

++
++

ALTER TABLE test_ttl UNSET 'ttl';

Affected Rows: 0

INSERT INTO
test_ttl
VALUES
(now(), 1),
(now(), 2),
(now(), 3),
(now() + INTERVAL '1 SECOND', 4),
(now() - INTERVAL '1 SECOND', 5);
(now(), 3);

Affected Rows: 3

SELECT
val
from
test_ttl;

+-----+
| val |
+-----+
| 1 |
| 2 |
| 3 |
+-----+

DROP TABLE test_ttl;

Affected Rows: 0

CREATE TABLE test_ttl(
ts TIMESTAMP TIME INDEX,
val INT,
PRIMARY KEY (`val`)
) WITH (ttl = '1s');

Affected Rows: 0

SHOW CREATE TABLE test_ttl;

+----------+-----------------------------------------+
| Table | Create Table |
+----------+-----------------------------------------+
| test_ttl | CREATE TABLE IF NOT EXISTS "test_ttl" ( |
| | "ts" TIMESTAMP(3) NOT NULL, |
| | "val" INT NULL, |
| | TIME INDEX ("ts"), |
| | PRIMARY KEY ("val") |
| | ) |
| | |
| | ENGINE=mito |
| | WITH( |
| | ttl = '1s' |
| | ) |
+----------+-----------------------------------------+

INSERT INTO
test_ttl
VALUES
(now(), 1),
(now(), 2),
(now(), 3);

Affected Rows: 3

SELECT
val
from
test_ttl;

+-----+
| val |
+-----+
| 1 |
| 2 |
| 3 |
+-----+

ADMIN flush_table('test_ttl');

+-------------------------------+
| ADMIN flush_table('test_ttl') |
+-------------------------------+
| 0 |
+-------------------------------+

ADMIN compact_table('test_ttl');

+---------------------------------+
| ADMIN compact_table('test_ttl') |
+---------------------------------+
| 0 |
+---------------------------------+

SELECT
val
from
test_ttl;

+-----+
| val |
+-----+
| 1 |
| 2 |
| 3 |
+-----+

-- SQLNESS SLEEP 2s
ADMIN flush_table('test_ttl');

+-------------------------------+
| ADMIN flush_table('test_ttl') |
+-------------------------------+
| 0 |
+-------------------------------+

ADMIN compact_table('test_ttl');

+---------------------------------+
| ADMIN compact_table('test_ttl') |
+---------------------------------+
| 0 |
+---------------------------------+

SELECT
val
from
test_ttl;

++
++

ALTER TABLE
test_ttl
SET
ttl = '1d';

Affected Rows: 0

INSERT INTO
test_ttl
VALUES
(now(), 1),
(now(), 2),
(now(), 3);

Affected Rows: 3

SELECT
val
from
test_ttl;

+-----+
| val |
+-----+
| 1 |
| 2 |
| 3 |
+-----+

ALTER TABLE
test_ttl
SET
ttl = 'instant';

Affected Rows: 0

ADMIN flush_table('test_ttl');

+-------------------------------+
| ADMIN flush_table('test_ttl') |
+-------------------------------+
| 0 |
+-------------------------------+

ADMIN compact_table('test_ttl');

+---------------------------------+
| ADMIN compact_table('test_ttl') |
+---------------------------------+
| 0 |
+---------------------------------+

SELECT
val
from
test_ttl;

++
++

ALTER TABLE
test_ttl
SET
ttl = '1s';

Affected Rows: 0

INSERT INTO
test_ttl
VALUES
(now(), 1),
(now(), 2),
(now(), 3);

Affected Rows: 3

SELECT
val
from
test_ttl;

+-----+
| val |
+-----+
| 1 |
| 2 |
| 3 |
+-----+

-- SQLNESS SLEEP 2s
ADMIN flush_table('test_ttl');

Expand Down
Loading

0 comments on commit c5186dd

Please sign in to comment.