20180615:
Hive是基于Hadoop的一个数据仓库工具,是一种逻辑上的数据库,依赖hdfs文件系统;它把实际的数据文件映射为一张数据库表来作为元数据来管理hdfs上的数据。Hive存在的意义并非数据存储,而是被用来处理数据的,它计算的实质是用sql调用了底层的mapreduce。因为hive的sql的学习成本比较低,几乎和mysql这些数据库近似,所以使用极其广泛。很多公司使用hive几乎都能够撑起整个项目。
cd bigdata-Guanxiyingxiao/Guanxiyingxiao/2018
get Guanxiyingxiao.zip
cd dawen.chi/product_city_staypoint_data/2018
get product_city_staypoint_data.zip
cd ctyun-product-tianyuan/city-plan-paltform/2018
get city-plan-paltform.zip
清空hive表:
insert overwrite table dal_bdcsc_bad_black_list_m select * from t_table1 where 1=0;
md5加密:
愛癡 2018/6/25 15:25:21
yarn queue -status pro2
愛癡 2018/6/25 15:25:32
你用这个看看队列资源
秦文杰 2018/6/25 15:26:02
愛癡 2018/6/25 15:26:06
hadoop job -list | 队列名 用这个命令看看你现在的队列上面有几个任务
15:26:35
愛癡 2018/6/25 15:26:35
hadoop job -list | grep test1
秦文杰 2018/6/25 15:27:05
INSERT OVERWRITE table csqinwj.dal_bdcsc_bad_black_list_m PARTITION(PROV_ID, MONTH_ID)
select g.accs_nbr,
g.cert_nbr,
g.cust_name,
g.prov_id,
201705 MONTH_ID
from (select accs_nbr,
cert_nbr,
cust_name,
uninstall_date,
prov_id
from CSQINWJ.DWI_SEV_USER_MAIN_INFO_PRO_MSK_M
where month_id=‘201804‘ and cert_type=‘1‘)g --证件类型为身份证
INNER join
(select MD5(t.accs_nbr) accs_nbr,
substr(t.biz_event_time,1,8) time
from(select b.accs_nbr,
b.biz_event_time,
max(case when a.rn=b.rn+1 then a.order_type end) type_a,
max(case when a.rn=b.rn+2 then a.order_type end) type_b
from (select a.accs_nbr,
a.user_status,
a.order_type,
a.biz_event_time,
row_number() over(partition by a.accs_nbr order by a.biz_event_time desc) as rn
from (select accs_nbr,
user_status,
order_type,
biz_event_time,
row_number() over(partition by accs_nbr order by biz_event_time desc) as rn
from csqinwj.dwi_sev_user_vsop_decode_d_mid where MONTH_ID<=201705) a
left join (select accs_nbr,
user_status,
order_type,
biz_event_time,
row_number() over(partition by accs_nbr order by biz_event_time desc) as rn
from csqinwj.dwi_sev_user_vsop_decode_d_mid where MONTH_ID<=201705) b
on a.accs_nbr = b.accs_nbr and a.rn = b.rn + 1
where a.order_type <> nvl(b.order_type, ‘0‘)) a
inner join (select * from (select a.accs_nbr,
a.user_status,
a.order_type,
a.biz_event_time,
row_number() over(partition by a.accs_nbr order by a.biz_event_time desc) as rn
from (select accs_nbr,
user_status,
order_type,
biz_event_time,
row_number() over(partition by accs_nbr order by biz_event_time desc) as rn
from csqinwj.dwi_sev_user_vsop_decode_d_mid where MONTH_ID<=201705) a
left join (select accs_nbr,
user_status,
order_type,
biz_event_time,
row_number() over(partition by accs_nbr order by biz_event_time desc) as rn
from csqinwj.dwi_sev_user_vsop_decode_d_mid where MONTH_ID<=201705) b
on a.accs_nbr = b.accs_nbr
and a.rn = b.rn + 1
where a.order_type <> nvl(b.order_type, ‘0‘))c where c.order_type=‘300‘ --销户/拆机
) b
on a.accs_nbr=b.accs_nbr
group by b.accs_nbr,b.biz_event_time,b.order_type)t
where t.type_a=‘48‘ or --欠费双停
(t.type_a=‘301‘ --预约销户
and t.type_b=‘48‘)) h
where g.accs_nbr=h.accs_nbr and substr(g.uninstall_date,1,8)=h.time;
hive的sql语句小节
原文:https://www.cnblogs.com/jie-2019/p/10369634.html