33-- ----------------------------------------------------------------------------------------------------------------------
44
55SELECT get_json_string(data, ' commit.collection' ) AS event,
6- count () AS count
7- FROM bluesky
8- GROUP BY event
6+ count () AS count
7+ FROM bluesky
8+ GROUP BY event
99ORDER BY count DESC ;
1010
1111-- ----------------------------------------------------------------------------------------------------------------------
@@ -17,33 +17,33 @@ SELECT
1717 count (DISTINCT get_json_string(data, ' did' )) AS users
1818FROM bluesky
1919WHERE (get_json_string(data, ' kind' ) = ' commit' )
20- AND (get_json_string(data, ' commit.operation' ) = ' create' )
20+ AND (get_json_string(data, ' commit.operation' ) = ' create' )
2121GROUP BY event
2222ORDER BY count DESC ;
2323
2424-- ----------------------------------------------------------------------------------------------------------------------
2525-- Q3 - When do people use BlueSky
2626-- ----------------------------------------------------------------------------------------------------------------------
2727SELECT
28- get_json_string(data, ' commit.collection' ) AS event,
28+ get_json_string(data, ' commit.collection' ) AS event,
2929 hour_from_unixtime(get_json_int(data, ' time_us' )/ 1000000 ) as hour_of_day,
3030 count () AS count
3131FROM bluesky
32- WHERE (get_json_string(data, ' kind' ) = ' commit' )
33- AND (get_json_string(data, ' commit.operation' ) = ' create' )
34- AND (array_contains([' app.bsky.feed.post' , ' app.bsky.feed.repost' , ' app.bsky.feed.like' ], get_json_string(data, ' commit.collection' )))
32+ WHERE (get_json_string(data, ' kind' ) = ' commit' )
33+ AND (get_json_string(data, ' commit.operation' ) = ' create' )
34+ AND (array_contains([' app.bsky.feed.post' , ' app.bsky.feed.repost' , ' app.bsky.feed.like' ], get_json_string(data, ' commit.collection' )))
3535GROUP BY event, hour_of_day
3636ORDER BY hour_of_day, event;
3737
3838-- ----------------------------------------------------------------------------------------------------------------------
3939-- Q4 - top 3 post veterans
4040-- ----------------------------------------------------------------------------------------------------------------------
4141SELECT
42- get_json_string(data, ' did' ) as user_id,
43- to_datetime(min (get_json_int(data, ' time_us' )), 6 ) AS first_post_date
42+ get_json_string(data, ' did' ) as user_id,
43+ to_datetime(min (get_json_int(data, ' time_us' )), 6 ) AS first_post_date
4444FROM bluesky
45- WHERE (get_json_string(data, ' kind' ) = ' commit' )
46- AND (get_json_string(data, ' commit.operation' ) = ' create' )
45+ WHERE (get_json_string(data, ' kind' ) = ' commit' )
46+ AND (get_json_string(data, ' commit.operation' ) = ' create' )
4747 AND (get_json_string(data, ' commit.collection' ) = ' app.bsky.feed.post' )
4848GROUP BY user_id
4949ORDER BY first_post_date ASC
@@ -53,13 +53,13 @@ LIMIT 3;
5353-- Q5 - top 3 users with longest activity
5454-- ----------------------------------------------------------------------------------------------------------------------
5555SELECT
56- get_json_string(data, ' did' ) as user_id,
57- date_diff(' millisecond' ,
56+ get_json_string(data, ' did' ) as user_id,
57+ date_diff(' millisecond' ,
5858 to_datetime(min (get_json_int(data, ' time_us' )), 6 ),
59- to_datetime(max (get_json_int(data, ' time_us' )), 6 )) AS activity_span
60- FROM bluesky_sorted
61- WHERE (get_json_string(data, ' kind' ) = ' commit' )
62- AND (get_json_string(data, ' commit.operation' ) = ' create' )
59+ to_datetime(max (get_json_int(data, ' time_us' )), 6 )) AS activity_span
60+ FROM bluesky
61+ WHERE (get_json_string(data, ' kind' ) = ' commit' )
62+ AND (get_json_string(data, ' commit.operation' ) = ' create' )
6363 AND (get_json_string(data, ' commit.collection' ) = ' app.bsky.feed.post' )
6464GROUP BY user_id
6565ORDER BY activity_span DESC
0 commit comments