Query editor
WITH ReactionCounts AS (-- Aggregate likes and recasts for each castSELECTr.target_hash AS hash,SUM(CASE WHEN r.reaction_type = 1 THEN 1 ELSE 0 END) AS likes_count,SUM(CASE WHEN r.reaction_type = 2 THEN 1 ELSE 0 END) AS recast_count,COUNT(*) AS total_reactionsFROMdune.neynar.dataset_farcaster_reactions rGROUP BYr.target_hash),CommentCounts AS (-- Aggregate comments for each castSELECTc.parent_hash AS hash,COUNT(*) AS comment_countFROMdune.neynar.dataset_farcaster_casts cWHEREc.parent_hash IS NOT NULL -- Only count replies as commentsGROUP BYc.parent_hash),TotalInteractions AS (-- Combine reaction counts and comment countsSELECTCOALESCE(rc.hash, cc.hash) AS hash,COALESCE(rc.likes_count, 0) AS likes_count,COALESCE(rc.recast_count, 0) AS recast_count,COALESCE(cc.comment_count, 0) AS comment_count,(COALESCE(rc.total_reactions, 0) + COALESCE(cc.comment_count, 0)) AS total_interactionsFROMReactionCounts rcFULL JOINCommentCounts cc ON rc.hash = cc.hashWHERE(COALESCE(rc.total_reactions, 0) + COALESCE(cc.comment_count, 0)) > 1000 -- Filter casts with >1000 interactions)SELECTt.total_interactions,t.likes_count,t.recast_count,t.comment_count,c.text,c.timestampFROMTotalInteractions tJOINdune.neynar.dataset_farcaster_casts c ON t.hash = c.hashORDER BYt.total_interactions DESC