mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
add bitmapAnd sql & reference
This commit is contained in:
parent
6cf7ac045b
commit
caedf9d91d
@ -13,15 +13,19 @@
|
|||||||
70
|
70
|
||||||
2019-01-01 50 [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]
|
2019-01-01 50 [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]
|
||||||
2019-01-02 60 [11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]
|
2019-01-02 60 [11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]
|
||||||
|
2019-01-03 10 [1,2,3,4,5,6,7,8,9,10]
|
||||||
60 50 70 40 20 30
|
60 50 70 40 20 30
|
||||||
60 50 70 40 20 30
|
60 50 70 40 20 30
|
||||||
90
|
100
|
||||||
90
|
100
|
||||||
20
|
20
|
||||||
90
|
100
|
||||||
20
|
20
|
||||||
|
[1,2,3]
|
||||||
|
[1,2,3]
|
||||||
2019-01-01 50
|
2019-01-01 50
|
||||||
2019-01-02 60
|
2019-01-02 60
|
||||||
|
2019-01-03 10
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
|
@ -15,6 +15,7 @@ DROP TABLE IF EXISTS bitmap_test;
|
|||||||
CREATE TABLE bitmap_test(pickup_date Date, city_id UInt32, uid UInt32)ENGINE = Memory;
|
CREATE TABLE bitmap_test(pickup_date Date, city_id UInt32, uid UInt32)ENGINE = Memory;
|
||||||
INSERT INTO bitmap_test SELECT '2019-01-01', 1, number FROM numbers(1,50);
|
INSERT INTO bitmap_test SELECT '2019-01-01', 1, number FROM numbers(1,50);
|
||||||
INSERT INTO bitmap_test SELECT '2019-01-02', 1, number FROM numbers(11,60);
|
INSERT INTO bitmap_test SELECT '2019-01-02', 1, number FROM numbers(11,60);
|
||||||
|
INSERT INTO bitmap_test SELECT '2019-01-03', 2, number FROM numbers(1,10);
|
||||||
|
|
||||||
|
|
||||||
SELECT groupBitmap( uid ) AS user_num FROM bitmap_test;
|
SELECT groupBitmap( uid ) AS user_num FROM bitmap_test;
|
||||||
@ -65,6 +66,9 @@ SELECT count(*) FROM bitmap_test WHERE bitmapContains((SELECT groupBitmapState(u
|
|||||||
|
|
||||||
SELECT count(*) FROM bitmap_test WHERE 0 = bitmapContains((SELECT groupBitmapState(uid) FROM bitmap_test WHERE pickup_date = '2019-01-01'), uid);
|
SELECT count(*) FROM bitmap_test WHERE 0 = bitmapContains((SELECT groupBitmapState(uid) FROM bitmap_test WHERE pickup_date = '2019-01-01'), uid);
|
||||||
|
|
||||||
|
-- PR#8082
|
||||||
|
SELECT bitmapToArray(bitmapAnd(groupBitmapState(uid), bitmapBuild(CAST([1, 2, 3], 'Array(UInt32)')))) FROM bitmap_test GROUP BY city_id;
|
||||||
|
|
||||||
-- bitmap state test
|
-- bitmap state test
|
||||||
DROP TABLE IF EXISTS bitmap_state_test;
|
DROP TABLE IF EXISTS bitmap_state_test;
|
||||||
CREATE TABLE bitmap_state_test
|
CREATE TABLE bitmap_state_test
|
||||||
|
Loading…
Reference in New Issue
Block a user