Hive使用中常见问题总结(四)

尊敬的读者您好:笔者很高兴自己的文章能被阅读,但原创与编辑均不易,所以转载请必须注明本文出处并附上本文地址超链接以及博主博客地址:https://blog.csdn.net/vensmallzeng。若觉得本文对您有益处还请帮忙点个赞鼓励一下,笔者在此感谢每一位读者,如需联系笔者,请记下邮箱:[email protected],谢谢合作!

 

 

 

1、创建分区表

CREATE TABLE if not exists dev_hotel.user_family_child_predict_result(
    `unionid`      string comment 'unionid',
    `predict_value`      string comment 'probability'
)
PARTITIONED BY (`dt` string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\001'
location '/data/hotel/dev/user_family_child_predict_result';

2、往分区表中写数据

insert overwrite table dev_hotel.user_family_child_predict_result partition (dt='20200311') 
select unionid, predict_value from dev_hotel.user_family_child_predict_result_tmp

3、 删除分区表中的分区以及内容

ALTER TABLE dev_hotel.user_family_child_predict_result DROP PARTITION (dt='20200311');

4、求解一组数据的2、4、6、8分位点

select percentile_approx(room_nights_num_city_ratio, array(0.2, 0.4, 0.6, 0.8)) as user_num_city_ratio
from dev_hotel.user_LBS_data_city_ratio

日积月累,与君共进,增增小结,未完待续。

发布了154 篇原创文章 · 获赞 151 · 访问量 12万+

猜你喜欢

转载自blog.csdn.net/Vensmallzeng/article/details/104905326