标签:des android style io ar os 使用 sp for
在pig中, dump和store会分别完毕两个MR, 不会一起进行
1:载入名用正則表達式:
LOAD ‘/user/wizad/data/wizad/raw/2014-0{6,7-0,7-1,7-2,7-3,8}*/3_1/adwords*‘2:filter的几种简单使用方法:
按值过滤
FILTER clickDate_all BY log_type==‘2‘;配合size函数
FILTER count_imei BY (SIZE(cimei)>14 AND SIZE(cimei)<17);
正則表達式
FILTER cimei2 BY NOT cimei MATCHES ‘^[0-9]*$‘;
3:排序
ORDER province_count BY $2 DESC;5:过滤空值,将空值改成取值unknown。
条件表达式“(推断式)?a:b”的应用:直接对列操作
origin_historical = FOREACH origin_cleaned_data GENERATE wizad_ad_id,guid,log_type,SPLIT allCleaned INTO log_42 IF (
((chararray)$34==‘1‘ OR (chararray)$34==‘2‘ OR (chararray)$34==‘3‘ OR (chararray)$34==‘1‘ OR (chararray)$34==‘4‘)
AND
(INDEXOF((chararray)$35,‘.‘)>0)
AND
((chararray)$36==‘1‘ OR (chararray)$36==‘‘)
),
log_43 IF (
((chararray)$34==‘1‘ OR (chararray)$34==‘2‘)
AND
((chararray)$35==‘1‘ OR (chararray)$35==‘2‘ OR (chararray)$35==‘3‘ OR (chararray)$35==‘1‘ OR (chararray)$35==‘4‘)
AND
(INDEXOF((chararray)$36,‘.‘)>0)
);
en_guid =STREAM duimei THROUGH `awk -F"," ‘{if($3 == "null") print $1","$2","; else print $0}‘`;
9:强制转换:
cleaned_data_42 =FOREACH log_42 GENERATE
(chararray)$1 AS wizad_ad_id:chararray,
(chararray)$2 AS guid:chararray,
(chararray)$6 AS log_type:chararray,
(chararray)$18 AS imei:chararray,
(chararray)$22 AS idfa:chararray,
(chararray)$23 AS mac_address:chararray
10内置函数REGEX_EXTRACT,使用正則表達式:
allAdId =FOREACH allRow GENERATE REGEX_EXTRACT((chararray)$3,‘(.*) (.*)‘,1) AS time,REGEX_EXTRACT((chararray)$0,‘(.*)_(.*)‘,1) AS adn,$6 AS ad_id;
allAdId =FOREACH allRow GENERATE REGEX_EXTRACT(create_time,‘(.*) (.*)‘,1) AS time,ad_id;
标签:des android style io ar os 使用 sp for
原文地址:http://www.cnblogs.com/yxwkf/p/4095629.html