Tests: add tests for new analyzer

This commit is contained in:
Nikita Fomichev 2024-07-02 18:15:57 +02:00
parent c4da270ddb
commit a020138764
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,27 @@
5 (4230072075578472911,4230072075578472911) 71789584853496063
2 (4401188181514187637,4401188181514187637) 878466845199253299
4 (4940826638032106783,4940826638032106783) 3675164899122807807
6 (10957420562507184961,10957420562507184961) 3732623117916254211
0 (797076400500506358,797076400500506358) 3746094338409299772
7 (10843611042193511775,10843611042193511775) 4607251742847087615
3 (12588286986351526898,12588286986351526898) 13889114719560662796
8 (452995860660674674,452995860660674674) 17365664920787500812
9 (12206106972241516904,12206106972241516904) 17567684527097330880
1 (14558425114501132193,14558425114501132193) 18445898820068822019
3 255 255
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0
1
2
3
4
5
6

View File

@ -0,0 +1,41 @@
SET allow_experimental_analyzer=1;
SELECT *, ngramMinHash(*) AS minhash, mortonEncode(untuple(ngramMinHash(*))) AS z
FROM (SELECT toString(number) FROM numbers(10))
ORDER BY z LIMIT 100;
CREATE TABLE test (
idx UInt64,
coverage Array(UInt64),
test_name String
)
ENGINE = MergeTree
ORDER BY tuple();
INSERT INTO test VALUES (10, [0,1,2,3], 'xx'), (20, [3,4,5,6], 'xxx'), (90, [3,4,5,6,9], 'xxxx');
WITH
4096 AS w, 4096 AS h, w * h AS pixels,
arrayJoin(coverage) AS num,
num DIV (32768 * 32768 DIV pixels) AS idx,
mortonDecode(2, idx) AS coord,
255 AS b,
least(255, uniq(test_name)) AS r,
255 * uniq(test_name) / (max(uniq(test_name)) OVER ()) AS g
SELECT r::UInt8, g::UInt8, b::UInt8
FROM test
GROUP BY coord
ORDER BY coord.2 * w + coord.1
WITH FILL FROM 0 TO 10;
CREATE TABLE seq (
number UInt64
)
ENGINE = MergeTree
ORDER BY tuple();
INSERT INTO seq VALUES (0), (6), (7);
WITH (Select min(number), max(number) from seq) as range Select * from numbers(range.1, range.2);