阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Hive使用HDFS目录数据创建Hive表分区

123次阅读
没有评论

共计 1239 个字符,预计需要花费 4 分钟才能阅读完成。

描述:

Hive 表 pms.cross_sale_path 建立以日期作为分区,将 hdfs 目录 /user/pms/workspace/ouyangyewei/testUsertrack/job1Output/crossSale 上的数据,写入该表的 $yesterday 分区上

表结构:

hive -e ” 
set mapred.job.queue.name=pms; 
 
drop table if exists pms.cross_sale_path; 
create external table pms.cross_sale_path 
(
track_id string, 
track_time string, 
session_id string, 
gu_id string, 
end_user_id string, 
page_category_id bigint, 
algorithm_id int, 
is_add_cart int, 
rcmd_product_id bigint, 
product_id bigint, 
category_id bigint, 
path_id string, 
path_type int, 
path_length int, 
path_list string, 
order_code string 

PARTITIONED BY (ds string) 
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t’ 
LINES TERMINATED BY ‘\n’ 
STORED AS TEXTFILE;” 

写法:

yesterday=`date -d -1days +%Y-%m-%d` 
hive -e “load data inpath ‘/user/pms/workspace/ouyangyewei/testUsertrack/job1Output/crossSale’ into table pms.cross_sale_path partition(ds=’$yesterday’);” 

基于 Hadoop 集群的 Hive 安装 http://www.linuxidc.com/Linux/2013-07/87952.htm

Hive 内表和外表的区别 http://www.linuxidc.com/Linux/2013-07/87313.htm

Hadoop + Hive + Map +reduce 集群安装部署 http://www.linuxidc.com/Linux/2013-07/86959.htm

Hive 本地独立模式安装 http://www.linuxidc.com/Linux/2013-06/86104.htm

Hive 学习之 WordCount 单词统计 http://www.linuxidc.com/Linux/2013-04/82874.htm

Hive 运行架构及配置部署 http://www.linuxidc.com/Linux/2014-08/105508.htm

Hive 的详细介绍 :请点这里
Hive 的下载地址 :请点这里

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计1239字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中