Skip to content

Instantly share code, notes, and snippets.

@nfarah86
Created May 2, 2022 19:16
Show Gist options
  • Save nfarah86/3c46cfc379fbef939084ecdc7950b374 to your computer and use it in GitHub Desktop.
Save nfarah86/3c46cfc379fbef939084ecdc7950b374 to your computer and use it in GitHub Desktop.
SELECT
count(*) tweets,
cast(DATE_TRUNC('HOUR', PARSE_TIMESTAMP('%a %h %d %H:%M:%S %z %Y', i.created_at)) as string) as event_date_hour_str,
DATE_TRUNC('HOUR', PARSE_TIMESTAMP('%a %h %d %H:%M:%S %z %Y', i.created_at)) as event_date_hour,
cast(i.user.id as string) id,
arbitrary(i.user.name) name
FROM
_input i
where
i.user.id is not null
and i.user.id is not undefined
group by
i.user.id,
event_date_hour_str,
event_date_hour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment