From 11bab0c47cce4fe09cd37763f7e1877d11178c7b Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Fri, 27 Dec 2024 14:40:18 +0800 Subject: [PATCH] feat: add sqlness test for bloom filter index (#5240) * feat: add sqlness test for bloom filter index Signed-off-by: Ruihang Xia * drop table after finished Signed-off-by: Ruihang Xia * redact more variables Signed-off-by: Ruihang Xia --------- Signed-off-by: Ruihang Xia --- ...sult => create_with_skipping_index.result} | 0 ...dex.sql => create_with_skipping_index.sql} | 0 .../common/select/skipping_index.result | 99 +++++++++++++++++++ .../common/select/skipping_index.sql | 38 +++++++ 4 files changed, 137 insertions(+) rename tests/cases/standalone/common/create/{create_with_skip_index.result => create_with_skipping_index.result} (100%) rename tests/cases/standalone/common/create/{create_with_skip_index.sql => create_with_skipping_index.sql} (100%) create mode 100644 tests/cases/standalone/common/select/skipping_index.result create mode 100644 tests/cases/standalone/common/select/skipping_index.sql diff --git a/tests/cases/standalone/common/create/create_with_skip_index.result b/tests/cases/standalone/common/create/create_with_skipping_index.result similarity index 100% rename from tests/cases/standalone/common/create/create_with_skip_index.result rename to tests/cases/standalone/common/create/create_with_skipping_index.result diff --git a/tests/cases/standalone/common/create/create_with_skip_index.sql b/tests/cases/standalone/common/create/create_with_skipping_index.sql similarity index 100% rename from tests/cases/standalone/common/create/create_with_skip_index.sql rename to tests/cases/standalone/common/create/create_with_skipping_index.sql diff --git a/tests/cases/standalone/common/select/skipping_index.result b/tests/cases/standalone/common/select/skipping_index.result new file mode 100644 index 000000000000..a083073c3394 --- /dev/null +++ b/tests/cases/standalone/common/select/skipping_index.result @@ -0,0 +1,99 @@ +create table + skipping_table ( + ts timestamp time index, + id string skipping index, + `name` string skipping index + with + (granularity = 8192), + ); + +Affected Rows: 0 + +INSERT INTO skipping_table VALUES (1664356800000, 'id1', 'name1'); + +Affected Rows: 1 + +ADMIN FLUSH_TABLE('skipping_table'); + ++-------------------------------------+ +| ADMIN FLUSH_TABLE('skipping_table') | ++-------------------------------------+ +| 0 | ++-------------------------------------+ + +INSERT INTO skipping_table VALUES (1664356801000, 'id2', 'name2'); + +Affected Rows: 1 + +ADMIN FLUSH_TABLE('skipping_table'); + ++-------------------------------------+ +| ADMIN FLUSH_TABLE('skipping_table') | ++-------------------------------------+ +| 0 | ++-------------------------------------+ + +INSERT INTO skipping_table VALUES (1664356802000, 'id3', 'name3'); + +Affected Rows: 1 + +ADMIN FLUSH_TABLE('skipping_table'); + ++-------------------------------------+ +| ADMIN FLUSH_TABLE('skipping_table') | ++-------------------------------------+ +| 0 | ++-------------------------------------+ + +-- 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 +EXPLAIN ANALYZE SELECT * FROM skipping_table WHERE id = 'id2' ORDER BY `name`; + ++-+-+-+ +| stage | node | plan_| ++-+-+-+ +| 0_| 0_|_MergeScanExec: REDACTED +|_|_|_| +| 1_| 0_|_SortPreservingMergeExec: [name@2 ASC NULLS LAST] REDACTED +|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED +|_|_|_SortExec: expr=[name@2 ASC NULLS LAST], preserve_partitioning=[true] REDACTED +|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED +|_|_|_FilterExec: id@1 = id2 REDACTED +|_|_|_RepartitionExec: partitioning=REDACTED +|_|_|_SeqScan: region=REDACTED, partition_count=3 (0 memtable ranges, 3 file 3 ranges) REDACTED +|_|_|_| +|_|_| Total rows: 1_| ++-+-+-+ + +-- 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 +EXPLAIN ANALYZE SELECT * FROM skipping_table WHERE id = 'id5' ORDER BY `name`; + ++-+-+-+ +| stage | node | plan_| ++-+-+-+ +| 0_| 0_|_MergeScanExec: REDACTED +|_|_|_| +| 1_| 0_|_SortPreservingMergeExec: [name@2 ASC NULLS LAST] REDACTED +|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED +|_|_|_SortExec: expr=[name@2 ASC NULLS LAST], preserve_partitioning=[true] REDACTED +|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED +|_|_|_FilterExec: id@1 = id5 REDACTED +|_|_|_RepartitionExec: partitioning=REDACTED +|_|_|_SeqScan: region=REDACTED, partition_count=3 (0 memtable ranges, 3 file 3 ranges) REDACTED +|_|_|_| +|_|_| Total rows: 0_| ++-+-+-+ + +DROP TABLE IF EXISTS skipping_table; + +Affected Rows: 0 + diff --git a/tests/cases/standalone/common/select/skipping_index.sql b/tests/cases/standalone/common/select/skipping_index.sql new file mode 100644 index 000000000000..9f9a38e25d1e --- /dev/null +++ b/tests/cases/standalone/common/select/skipping_index.sql @@ -0,0 +1,38 @@ +create table + skipping_table ( + ts timestamp time index, + id string skipping index, + `name` string skipping index + with + (granularity = 8192), + ); + +INSERT INTO skipping_table VALUES (1664356800000, 'id1', 'name1'); + +ADMIN FLUSH_TABLE('skipping_table'); + +INSERT INTO skipping_table VALUES (1664356801000, 'id2', 'name2'); + +ADMIN FLUSH_TABLE('skipping_table'); + +INSERT INTO skipping_table VALUES (1664356802000, 'id3', 'name3'); + +ADMIN FLUSH_TABLE('skipping_table'); + +-- 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 +EXPLAIN ANALYZE SELECT * FROM skipping_table WHERE id = 'id2' ORDER BY `name`; + +-- 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 +EXPLAIN ANALYZE SELECT * FROM skipping_table WHERE id = 'id5' ORDER BY `name`; + +DROP TABLE IF EXISTS skipping_table;