-- 插入follow事件 INSERT INTO events ( event_id, timestamp, date, hour, user_id, influencer_id, content_id, project_id, event_type, funnel_stage, platform, content_type, content_status, sentiment, followers_count, followers_change ) SELECT generateUUIDv4() as event_id, now() - interval rand() % 30 day - interval rand() % 24 hour as timestamp, toDate(timestamp) as date, toHour(timestamp) as hour, concat('user_', toString(number % 1000)) as user_id, concat('influencer_', toString(1 + number % 10)) as influencer_id, concat('content_', toString(number % 500)) as content_id, 'project_demo' as project_id, 'follow' as event_type, 'interest' as funnel_stage, multiIf( number % 4 = 0, 'Instagram', number % 4 = 1, 'TikTok', number % 4 = 2, 'Twitter', 'Facebook' ) as platform, multiIf( number % 6 = 0, 'video', number % 6 = 1, 'image', number % 6 = 2, 'text', number % 6 = 3, 'story', number % 6 = 4, 'reel', 'live' ) as content_type, 'approved' as content_status, multiIf( number % 3 = 0, 'positive', number % 3 = 1, 'neutral', 'negative' ) as sentiment, 100000 + (number % 900000) as followers_count, 1 as followers_change FROM numbers(1, 300); -- 插入300个follow事件 -- 插入unfollow事件(数量少于follow以保证净增长) INSERT INTO events ( event_id, timestamp, date, hour, user_id, influencer_id, content_id, project_id, event_type, funnel_stage, platform, content_type, content_status, sentiment, followers_count, followers_change ) SELECT generateUUIDv4() as event_id, now() - interval rand() % 30 day - interval rand() % 24 hour as timestamp, toDate(timestamp) as date, toHour(timestamp) as hour, concat('user_', toString(number % 1000)) as user_id, concat('influencer_', toString(1 + number % 10)) as influencer_id, concat('content_', toString(number % 500)) as content_id, 'project_demo' as project_id, 'unfollow' as event_type, 'interest' as funnel_stage, multiIf( number % 4 = 0, 'Instagram', number % 4 = 1, 'TikTok', number % 4 = 2, 'Twitter', 'Facebook' ) as platform, multiIf( number % 6 = 0, 'video', number % 6 = 1, 'image', number % 6 = 2, 'text', number % 6 = 3, 'story', number % 6 = 4, 'reel', 'live' ) as content_type, 'approved' as content_status, multiIf( number % 3 = 0, 'positive', number % 3 = 1, 'neutral', 'negative' ) as sentiment, 100000 + (number % 900000) as followers_count, -1 as followers_change FROM numbers(1, 120); -- 插入120个unfollow事件 -- 插入like事件 INSERT INTO events ( event_id, timestamp, date, hour, user_id, influencer_id, content_id, project_id, event_type, funnel_stage, platform, content_type, content_status, sentiment, likes_count, likes_change ) SELECT generateUUIDv4() as event_id, now() - interval rand() % 30 day - interval rand() % 24 hour as timestamp, toDate(timestamp) as date, toHour(timestamp) as hour, concat('user_', toString(number % 1000)) as user_id, concat('influencer_', toString(1 + number % 10)) as influencer_id, concat('content_', toString(number % 500)) as content_id, 'project_demo' as project_id, 'like' as event_type, 'interest' as funnel_stage, multiIf( number % 4 = 0, 'Instagram', number % 4 = 1, 'TikTok', number % 4 = 2, 'Twitter', 'Facebook' ) as platform, multiIf( number % 6 = 0, 'video', number % 6 = 1, 'image', number % 6 = 2, 'text', number % 6 = 3, 'story', number % 6 = 4, 'reel', 'live' ) as content_type, 'approved' as content_status, multiIf( number % 3 = 0, 'positive', number % 3 = 1, 'neutral', 'negative' ) as sentiment, 1000 + (number % 9000) as likes_count, 1 as likes_change FROM numbers(1, 500); -- 插入500个like事件 -- 插入unlike事件(数量少于like以保证净增长) INSERT INTO events ( event_id, timestamp, date, hour, user_id, influencer_id, content_id, project_id, event_type, funnel_stage, platform, content_type, content_status, sentiment, likes_count, likes_change ) SELECT generateUUIDv4() as event_id, now() - interval rand() % 30 day - interval rand() % 24 hour as timestamp, toDate(timestamp) as date, toHour(timestamp) as hour, concat('user_', toString(number % 1000)) as user_id, concat('influencer_', toString(1 + number % 10)) as influencer_id, concat('content_', toString(number % 500)) as content_id, 'project_demo' as project_id, 'unlike' as event_type, 'interest' as funnel_stage, multiIf( number % 4 = 0, 'Instagram', number % 4 = 1, 'TikTok', number % 4 = 2, 'Twitter', 'Facebook' ) as platform, multiIf( number % 6 = 0, 'video', number % 6 = 1, 'image', number % 6 = 2, 'text', number % 6 = 3, 'story', number % 6 = 4, 'reel', 'live' ) as content_type, 'approved' as content_status, multiIf( number % 3 = 0, 'positive', number % 3 = 1, 'neutral', 'negative' ) as sentiment, 1000 + (number % 9000) as likes_count, -1 as likes_change FROM numbers(1, 200); -- 插入200个unlike事件