mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 02:12:21 +00:00
Add cardinalities test
This commit is contained in:
parent
c3ac011795
commit
1630651f54
@ -0,0 +1,38 @@
|
|||||||
|
Alex 1 63 0
|
||||||
|
Alex 1 65 0
|
||||||
|
Alex 1 239 0
|
||||||
|
Alex 2 224 0
|
||||||
|
Alex 4 83 0
|
||||||
|
Alex 4 134 0
|
||||||
|
Alex 4 192 0
|
||||||
|
Bob 2 53 0
|
||||||
|
Bob 4 100 0
|
||||||
|
Bob 4 177 0
|
||||||
|
Bob 4 177 0
|
||||||
|
Nikita 1 173 0
|
||||||
|
Nikita 1 228 0
|
||||||
|
Nikita 2 148 0
|
||||||
|
Nikita 2 148 0
|
||||||
|
Nikita 2 208 0
|
||||||
|
Alex 1 63 1
|
||||||
|
Alex 1 65 1
|
||||||
|
Alex 1 239 1
|
||||||
|
Alex 2 128 1
|
||||||
|
Alex 2 128 1
|
||||||
|
Alex 2 224 1
|
||||||
|
Alex 4 83 1
|
||||||
|
Alex 4 83 1
|
||||||
|
Alex 4 134 1
|
||||||
|
Alex 4 134 1
|
||||||
|
Alex 4 192 1
|
||||||
|
Bob 2 53 1
|
||||||
|
Bob 2 53 1
|
||||||
|
Bob 2 187 1
|
||||||
|
Bob 2 187 1
|
||||||
|
Bob 4 100 1
|
||||||
|
Nikita 1 173 1
|
||||||
|
Nikita 1 228 1
|
||||||
|
Nikita 2 54 1
|
||||||
|
Nikita 2 54 1
|
||||||
|
Nikita 2 148 1
|
||||||
|
Nikita 2 208 1
|
@ -0,0 +1,11 @@
|
|||||||
|
-- Checks that RowOptimizer correctly selects the order for columns according to cardinality, with an empty ORDER BY.
|
||||||
|
-- There are 4 columns with cardinalities {name : 3, timestamp": 3, money: 17, flag: 2}, so the columns order must be {flag, name, timestamp, money}.
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS tab;
|
||||||
|
|
||||||
|
CREATE TABLE tab (name String, timestamp Int64, money UInt8, flag String) ENGINE = MergeTree ORDER BY () SETTINGS allow_experimental_optimized_row_order = True;
|
||||||
|
INSERT INTO tab VALUES ('Bob', 4, 100, '1'), ('Nikita', 2, 54, '1'), ('Nikita', 1, 228, '1'), ('Alex', 4, 83, '1'), ('Alex', 4, 134, '1'), ('Alex', 1, 65, '0'), ('Alex', 4, 134, '1'), ('Bob', 2, 53, '0'), ('Alex', 4, 83, '0'), ('Alex', 1, 63, '1'), ('Bob', 2, 53, '1'), ('Alex', 4, 192, '1'), ('Alex', 2, 128, '1'), ('Nikita', 2, 148, '0'), ('Bob', 4, 177, '0'), ('Nikita', 1, 173, '0'), ('Alex', 1, 239, '0'), ('Alex', 1, 63, '0'), ('Alex', 2, 224, '1'), ('Bob', 4, 177, '0'), ('Alex', 2, 128, '1'), ('Alex', 4, 134, '0'), ('Alex', 4, 83, '1'), ('Bob', 4, 100, '0'), ('Nikita', 2, 54, '1'), ('Alex', 1, 239, '1'), ('Bob', 2, 187, '1'), ('Alex', 1, 65, '1'), ('Bob', 2, 53, '1'), ('Alex', 2, 224, '0'), ('Alex', 4, 192, '0'), ('Nikita', 1, 173, '1'), ('Nikita', 2, 148, '1'), ('Bob', 2, 187, '1'), ('Nikita', 2, 208, '1'), ('Nikita', 2, 208, '0'), ('Nikita', 1, 228, '0'), ('Nikita', 2, 148, '0');
|
||||||
|
|
||||||
|
SELECT * FROM tab SETTINGS max_threads=1;
|
||||||
|
|
||||||
|
DROP TABLE tab;
|
Loading…
Reference in New Issue
Block a user