每日日报2021.9.28

完成内容:

1.编写2019 级课堂测试试卷-HIVE 数据分析

统计代理商2

 

insert overwrite table leiyu3  select day_id as day_id ,sale_nbr as sale_nbr,count(*) from leilei where sale_nbr like 'O%'  group by day_id,sale_nbr;

 

 

 

统计代理商4

 

create table daiout as select day_id as day_id,sale_nbr as sale_nbr,sum(cnt)as cnt,sum(round)as round from leilei where sale_nbr like 'O%' group by day_id,sale_nbr;

create table daiin as select day_id as day_id,buy_nbr as buy_nbr,sum(cnt)as cnt,sum(round)as round from leilei where buy_nbr like 'O%' group by day_id,buy_nbr;

create table leiyu4 as select daiin.day_id as day_id,daiout.sale_nbr as sale_nbr,daiin.cnt as incnt,daiin.round as inround,daiout.cnt as outcnt,daiout.round as outround,daiout.round-daiin.round as li from daiin join daiout on (daiin.buy_nbr=daiout.sale_nbr);

 

 

 

 

依次导出

 

bin/sqoop export \
--connect jdbc:mysql://centos01:3306/lalala \
--username root \
--password 000000 \
--table leiyu2 \
--num-mappers 1 \
--export-dir /user/hive/warehouse/leiyu2 \
--input-null-string '\\N' \
--input-null-non-string '\\N' \
--input-fields-terminated-by "\t"

 

 

 

 

遇到问题:
导出不成功 一直报错 已解决 原因 格式不匹配导致导出失败
目标:继续学习hadoop
posted @ 2021-09-28 23:11  1905-1雷宇  阅读(51)  评论(0编辑  收藏  举报