Skip to content

Instantly share code, notes, and snippets.

@qi-qi
Created February 17, 2019 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qi-qi/332b9c0f2be8e483845191dbd38d2837 to your computer and use it in GitHub Desktop.
Save qi-qi/332b9c0f2be8e483845191dbd38d2837 to your computer and use it in GitHub Desktop.
athena double unnest
with dataset as (
select request_id, ad.t, ad.i, ad.p, ad.s, ad.e, ad.v, ad.impurls
from data_raw.batch, unnest(data_raw.batch.ads) as t(ad)
where dt = '2019-02-16' and h = '00' and request_id = '5F4_P7KSUFDdegHlGoFGcfBb2eGSH9NQpW3kuwoW7EFYt0GApaivCQ==')
select request_id, t, i, p, s, e, v, impurl
from dataset, unnest(impurls) as t(impurl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment