in-memory parts: test for basic functionality

This commit is contained in:
Anton Popov 2020-05-05 04:24:51 +03:00
parent aa723d245f
commit b3cfce523c
2 changed files with 60 additions and 0 deletions

View File

@ -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

View File

@ -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;