r/bigquery • u/fhoffa • Jul 07 '15
1.7 billion reddit comments loaded on BigQuery
Dataset published and compiled by /u/Stuck_In_the_Matrix, in r/datasets.
Tables available on BigQuery at https://bigquery.cloud.google.com/table/fh-bigquery:reddit_comments.2015_05.
Sample visualization: Most common reddit comments, and their average score (view in Tableau):
SELECT RANK() OVER(ORDER BY count DESC) rank, count, comment, avg_score, count_subs, count_authors, example_id
FROM (
SELECT comment, COUNT(*) count, AVG(avg_score) avg_score, COUNT(UNIQUE(subs)) count_subs, COUNT(UNIQUE(author)) count_authors, FIRST(example_id) example_id
FROM (
SELECT body comment, author, AVG(score) avg_score, UNIQUE(subreddit) subs, FIRST('http://reddit.com/r/'+subreddit+'/comments/'+REGEXP_REPLACE(link_id, 't[0-9]_','')+'/c/'+id) example_id
FROM [fh-bigquery:reddit_comments.2015_05]
WHERE author NOT IN (SELECT author FROM [fh-bigquery:reddit_comments.bots_201505])
AND subreddit IN (SELECT subreddit FROM [fh-bigquery:reddit_comments.subr_rank_201505] WHERE authors>10000)
GROUP EACH BY 1, 2
)
GROUP EACH BY 1
ORDER BY 2 DESC
LIMIT 300
)
137
Upvotes
18
u/fhoffa Jul 08 '15 edited Jul 09 '15
Reddit cliques: Sub-reddits that share the same commenters.
http://i.imgur.com/6h6sWun.png
Visualized at http://bit.ly/reddit-cliques
8
u/fhoffa Jul 08 '15
Video visualization of the subreddit comment history:
https://www.youtube.com/watch?v=l8MLIfU21pk
The query I used to get the data for this visualization:
5
u/fhoffa Jul 08 '15 edited Jul 08 '15
/u/minimaxir used this dataset to visualize the correlation between comment length and score:
They even released code to github, to re-create this viz using R:
8
u/Stuck_In_the_Matrix Jul 07 '15
How long did bigquery take to run this SQL statement?
5
u/shaggorama Jul 12 '15 edited Jul 12 '15
I just realized: I was just querying May 2015. For anyone else making the same mistake as me, the following query gives you a union over all the relevant tables:
Be warned: if you play with this union, you're liable to hit the free tier query quota pretty fast (in which case you'll have to wait a month to play more).
3
u/jeffhughes Jul 15 '15
Hey, this is amazing! I appreciate that you've made this publicly available.
I am a researcher that would like to do some between-subreddit comparisons, and I've been currently pulling comments via the Reddit API, but as far as I can tell it only lets me pull from ~2 weeks back, and it would be really nice to have that historical data.
If I could ask some questions (of /u/fhoffa or anyone else who can answer them):
2
u/fhoffa Jul 09 '15
h/t to /u/Jiecut, that wrote the most BigQuery insightful comments at the /r/dataisbeautiful/comments/3cofju/reddit_cliques_n2_deeper_into_the_subs_oc/ co-related post
thanks /u/Jiecut!
2
u/killver Jul 13 '15
Thanks a lot /u/fhoffa! Two quick questions though. (i) How did you generate the bot table? I cannot find a bot identifier in the comment data. (ii) As you are the BigQuery guru, maybe you know how I can track down the following error "Error: Resources exceeded during query execution.". I have a huge GROUP EACH BY statement that seems to be the problem.
2
u/MaunaLoona Jul 15 '15 edited Jul 15 '15
This is really cool! Thanks for sharing the data sets.
Top posters in a subreddit. Meant for creating a table in reddit:
Note it takes a long time to run for larger subreddits. Setting a LIMIT might help. For /r/bigquery:
Uncomment /*AvgLength,*/ to get average post length in exchange for a big $$ data bill.
I couldn't figure out how to get both the min and the max links using window functions so I did something similar to CROSS APPLY using INNER JOINs. I think I can eliminate one of the INNER JOINs by doing ROW_NUMBER() OVER(). Can't think of a way to get rid of the second one.
See a bigger table for /r/anarcho_capitalism.
2
u/Norci Sep 12 '15
Hm, when I click on BigQ link, it just lands me on "welcome to big query" popup with "loading" in the background. Is it no longer public? Also, is there any front end fot searching this data yet?
2
u/fhoffa Jul 14 '15
Most popular words that other sub-reddits don't say:
http://i.imgur.com/5Ysd1jE.png
Works by looking at the most popular words in one sub-reddit, and removes the most popular words in other sub-reddits.
1
u/fhoffa Jul 19 '15
Cohorts
1
u/fhoffa Jul 23 '15
Number of comments per day of week - June 2015:
1
u/fhoffa Jul 23 '15
Reddit word associations: June 2015 presidential edition.
https://i.imgur.com/TTUNnAY.jpg
1
u/fhoffa Jul 30 '15
Which subreddits showed up in your threads
1
u/fhoffa Aug 26 '15
Biggest growers July 2015 by number of authors:
Biggest losers:
From the 201507 update: /r/bigquery/comments/3if7lv/reddit_comments_dataset_updated_to_july_2015/
1
u/can_the_judges_djp Jul 15 '15
I cannot into complicated SQL queries, can somebody tell me how to simplify this to just output a list of all unique words in all comments (and without removing punctuation from them?).
1
u/ocdinfested Dec 01 '15
Hi /u/fhoffa . Firstly, off the bat, thank you for this work. I'm working on analysing jokes on Reddit. I'm planning to start looking into a single subreddit like /r/funny and working my way from there. Unfortunately I'm no good with BigQuery or SQL for that matter. Could I get some help regarding this?
1
u/Limp-Wishbone9591 Sep 18 '24
i want this dataset but looks like link do not work now
2
u/duddha Jul 15 '15
Thanks! ( ͡° ͜ʖ ͡°)
But for reals, thanks for this. And thanks for providing the sample searches and visualizations.
2
u/artificialbrilliance Jul 12 '15
I am interested in hiring someone to help me data mine this for an NLP project I am working on. Please contact me if you have amazing BigQuery skills. :)
1
u/numorate Jul 11 '15
I want all the url submissions in a given subreddit, but all I can find in the table is "link_id". How do I map link_ids to urls?
1
u/rovert13 Nov 02 '15
1.7 billion reddit comments - how many posts/comments are diamonds ? tens ? maybe .. hundreds ?... maximally ... what are diamonds ? and how to get them from that ocean of nothing ? diamonds imho are not cool funny jokes ... but serious unbiased genuine flash lights of god 's (universe) mindset valued archiving for the future evolution of the mankind as some base station upon that next giants may continue in the effort to give "best of the best possible in their times"
1
u/happy_bluebird Jan 08 '23
oooh this is great, would love to see a 2022 update :)
1
u/bulletninja Jul 07 '15
chuckled at the most comment in /r/gaming, simplest of them all.