added test cases for bitmapContains

This commit is contained in:
Zhichang Yu 2019-06-05 16:49:50 +08:00
parent b694d039c1
commit a477920206
2 changed files with 31 additions and 0 deletions

View File

@ -18,6 +18,8 @@
90 90
90 90
20 20
90
20
2019-01-01 50 2019-01-01 50
2019-01-02 60 2019-01-02 60
1 1
@ -50,3 +52,10 @@
0 0
1 1
0 0
0
0
0
1
1
0
1

View File

@ -62,6 +62,10 @@ SELECT count(*) FROM bitmap_test WHERE bitmapHasAny(bitmapBuild([uid]), (SELECT
SELECT count(*) FROM bitmap_test WHERE 0 = bitmapHasAny((SELECT groupBitmapState(uid) FROM bitmap_test WHERE pickup_date = '2019-01-01'), bitmapBuild([uid])); SELECT count(*) FROM bitmap_test WHERE 0 = bitmapHasAny((SELECT groupBitmapState(uid) FROM bitmap_test WHERE pickup_date = '2019-01-01'), bitmapBuild([uid]));
SELECT count(*) FROM bitmap_test WHERE 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);
-- 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
@ -171,3 +175,21 @@ select bitmapHasAll(bitmapBuild([
0,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, 0,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,
100,200,500]),bitmapBuild([ 100, 200, 501, 100,200,500]),bitmapBuild([ 100, 200, 501,
0,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])); 0,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]));
-- bitmapContains:
---- Empty
SELECT bitmapContains(bitmapBuild(emptyArrayUInt32()), CAST(0, 'UInt32'));
SELECT bitmapContains(bitmapBuild(emptyArrayUInt16()), CAST(5, 'UInt32'));
---- Small
select bitmapContains(bitmapBuild([1,5,7,9]),CAST(0, 'UInt32'));
select bitmapContains(bitmapBuild([1,5,7,9]),CAST(9, 'UInt32'));
---- Large
select bitmapContains(bitmapBuild([
0,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,
100,200,500]),CAST(100, 'UInt32'));
select bitmapContains(bitmapBuild([
0,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,
100,200,500]),CAST(101, 'UInt32'));
select bitmapContains(bitmapBuild([
0,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,
100,200,500]),CAST(500, 'UInt32'));