1 SELECT 2 groupBitmapAnd(uv) 3 ,groupBitmapOr(uv) 4 ,bitmapToArray(groupBitmapAndState(uv)) 5 ,arraySort(bitmapToArray(groupBitmapAndState(uv))) 6 ,arraySort(bitmapToArray(groupBitmapOrState(uv))) 7 FROM ( 8 SELECT '1' AS id , bitmapBuild(cast([1,2,3,4,5,6,7,8,9,10] as Array(UInt32))) AS uv 9 UNION ALL SELECT '1' AS id , bitmapBuild(cast([6,7,8,9,10,11,12,13,14,15] as Array(UInt32))) AS uv 10 UNION ALL SELECT '1' AS id , bitmapBuild(cast([1,2,4,6,8,10,12] as Array(UInt32))) AS uv 11 ) t 12 13 14 15 SELECT 16 groupBitmapAnd(uv) "交集" 17 ,arraySort(bitmapToArray(groupBitmapAndState(uv))) "交集_list" 18 ,groupBitmapOr(uv) "并集" 19 ,arraySort(bitmapToArray(groupBitmapOrState(uv))) "并集_list" 20 FROM ( 21 SELECT '1' AS id , bitmapBuild([1,2,3,4,5,6,7,8,9,10]) AS uv 22 UNION ALL SELECT '1' AS id , bitmapBuild([6,7,8,9,10,11,12,13,14,15]) AS uv 23 UNION ALL SELECT '1' AS id , bitmapBuild([1,2,4,6,8,10,12]) AS uv 24 ) t