liudezheng 发表于 2018-5-15 11:15:46

常用hive命令

DROP TABLE IF EXISTS manual.A;
CREATE TABLEmanual.A(email string,user_id string)ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';
load data local inpath '/tmp/ldz/AA.csv' overwrite into table manual.A ;

GET_JSON_OBJECT(row_ip2dmp(ipctor,'HWIP|CN|VAL','hwipinnet.csv'), '$.CTOR') ipctor

create table 表A ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' as select * from 表B;

select group_concat(ip, ',') as groups from 表A where pt_date=20170608 and vt='pv' group by sid

show create table 表名;

hive -e 'SELECT * FROM table' > table.csv

load data local inpath '/tmp/AA.csv'into table 表A partition (pt_year='2017',pt_month='201712',pt_date='20171217');

regexp_extract(r7,'(.*)/',1) in ('DOC1000081706','DOC1000081707','DOC1000081708','DOC1000081709',
                                     'DOC1000081710','DOC1000081702','DOC1000081703','DOC1000081704','DOC1000081701','DOC1000081700')

百分数cast((cast((t2.pv/t1.pv) as decimal(9,4)))*100 as varchar(10))+'%'                       

insert into table 表A SELECT * FROM 表B;                                               

create table if not exists

qqq911 发表于 2018-5-15 11:34:17

感谢分享
页: [1]
查看完整版本: 常用hive命令