Skip to content

Instantly share code, notes, and snippets.

@rafaelkallis
Created November 3, 2018 16:29
Show Gist options
  • Save rafaelkallis/437c6af4d0cd9d6b1f66baf7743ab39f to your computer and use it in GitHub Desktop.
Save rafaelkallis/437c6af4d0cd9d6b1f66baf7743ab39f to your computer and use it in GitHub Desktop.
issue lifetime
SELECT
created_at,
closed_at,
CONCAT(title, ' ', REGEXP_REPLACE(body, '(\r|\n|\r\n)',' ')) AS text
FROM (
SELECT
JSON_EXTRACT_SCALAR(payload, '$.issue.created_at') AS created_at,
JSON_EXTRACT_SCALAR(payload, '$.issue.closed_at') AS closed_at,
JSON_EXTRACT_SCALAR(payload, '$.action') AS action,
JSON_EXTRACT_SCALAR(payload, '$.issue.title') AS title,
JSON_EXTRACT_SCALAR(payload, '$.issue.body') AS body
FROM
-- [githubarchive:day.20180201],
-- [githubarchive:day.20180202],
-- [githubarchive:day.20180203],
-- [githubarchive:day.20180204],
[githubarchive:day.20180205]
WHERE
type = 'IssuesEvent'
)
WHERE
body != 'null'
AND action = 'closed'
LIMIT 10000;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment