Skip to content

Instantly share code, notes, and snippets.

@dgomesbr
Created September 4, 2014 22:01
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 dgomesbr/53cfbf0ba48a792d6c3d to your computer and use it in GitHub Desktop.
Save dgomesbr/53cfbf0ba48a792d6c3d to your computer and use it in GitHub Desktop.
DROP TABLE REVIVE_AD_VIS;
CREATE EXTERNAL TABLE REVIVE_AD_VIS ( hour String, bannerid STRING, campaignid STRING, zoneid STRING, count STRING )
row format
delimited fields terminated by ','
lines terminated by '\n'
STORED
AS TEXTFILE LOCATION 's3n://EMRresult/OutputFolder';
INSERT OVERWRITE TABLE REVIVE_AD_VIS
SELECT
substr(`timestamp`,12,2), bannerid, campaignid, zoneid, count(*)
FROM
elb_raw_access_logs
LATERAL VIEW parse_url_tuple(url, 'PATH','QUERY:bannerid','QUERY:campaignid','QUERY:zoneid') b as path, bannerid, campaignid, zoneid
where
instr(b.path,'lg.php') > 0
group by substr(`timestamp`,12,2), bannerid, campaignid, zoneid;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment