select'2023-03-11' as group_version
, 123 as group_id
, bitmap_uid as bitmap_uid
from (
SELECT bitmap_union(bitmap_uid) as bitmap_uid, 1 as joinKey
FROM (
SELECT bitmap_uid as bitmap_uid, 1 joinKey
FROM user_label
WHERE label_version ='2023-03-11'
and label_name ='charge_amt'
AND label_value <1000.0
UNION ALL
SELECT to_bitmap(entity_id) as bitmap_uid, 1 as joinKey
FROM (
SELECT uid as entity_id
FROM dwd_event
WHERE brand ='xiaomi' AND event_time BETWEEN '2022-11-04 00:00:00'
AND '2023-02-02 23:59:59' and tag_name IN ('tag_a') GROUP BY uid HAVING COUNT(1)>=1) t2
) t3
) user_group_temp