From b3cfce523c24e560a76f652a423cbad252e5cf5d Mon Sep 17 00:00:00 2001 From: Anton Popov Date: Tue, 5 May 2020 04:24:51 +0300 Subject: [PATCH] in-memory parts: test for basic functionality --- .../01130_in_memory_parts.reference | 27 +++++++++++++++ .../0_stateless/01130_in_memory_parts.sql | 33 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/queries/0_stateless/01130_in_memory_parts.reference create mode 100644 tests/queries/0_stateless/01130_in_memory_parts.sql diff --git a/tests/queries/0_stateless/01130_in_memory_parts.reference b/tests/queries/0_stateless/01130_in_memory_parts.reference new file mode 100644 index 00000000000..dbf39a0b48f --- /dev/null +++ b/tests/queries/0_stateless/01130_in_memory_parts.reference @@ -0,0 +1,27 @@ +Simple selects +0 0 +1 1 +2 2 +3 0 +4 1 +50 2 +51 0 +52 1 +53 2 +54 0 +34 +0 +Mutations and Alters +66 +1 1 +2 2 +4 1 +5 2 +7 1 +[1,1] +[] +[4,16] +[] +[7,49] +1 1 +2 1 diff --git a/tests/queries/0_stateless/01130_in_memory_parts.sql b/tests/queries/0_stateless/01130_in_memory_parts.sql new file mode 100644 index 00000000000..4c09eb19937 --- /dev/null +++ b/tests/queries/0_stateless/01130_in_memory_parts.sql @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS in_memory; +CREATE TABLE in_memory (a UInt32, b UInt32) + ENGINE = MergeTree ORDER BY a + SETTINGS min_rows_for_compact_part = 0; + +INSERT INTO in_memory SELECT number, number % 3 FROM numbers(100); + +SELECT 'Simple selects'; + +SELECT * FROM in_memory ORDER BY a LIMIT 5; +SELECT * FROM in_memory ORDER BY a LIMIT 5 OFFSET 50; +SELECT count() FROM in_memory WHERE b = 0 SETTINGS max_block_size = 10; +-- Check index +SELECT count() FROM in_memory WHERE a > 100 SETTINGS max_rows_to_read = 0, force_primary_key = 1; + +SELECT 'Mutations and Alters'; +SET mutations_sync = 1; + +ALTER TABLE in_memory DELETE WHERE b = 0; + +SELECT count() FROM in_memory; +SELECT * FROM in_memory ORDER BY a LIMIT 5; + +ALTER TABLE in_memory ADD COLUMN arr Array(UInt64); +ALTER TABLE in_memory UPDATE arr = [a, a * a] WHERE b = 1; + +SELECT arr FROM in_memory ORDER BY a LIMIT 5; + +ALTER TABLE in_memory MODIFY COLUMN b String; +ALTER TABLE in_memory RENAME COLUMN b to str; +SELECT DISTINCT str, length(str) FROM in_memory ORDER BY str; + +DROP TABLE in_memory;