设为首页 加入收藏

TOP

将hdfs文件加载到hive分区表
2019-04-24 00:17:10 】 浏览:58
Tags:hdfs 文件 加载 hive 分区表
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lislie_/article/details/86310740

shell脚本如下:
如果目标表有分区,先清除分区

alter table table_name drop partition (dt >= ‘20181211’);

#!/bin/bash
cu_date=`date +%Y%m%d`
begin_date="20181211"

while [ "$begin_date" -le "$cu_date" ];
do
	echo "${begin_date}"
	
	hive -e "alter table table_name add partition (dt='${begin_date}') 
	locatition 'hdfs://Cluster/user/hive/warehouse/.../dt=${begin_date}'; "
	
	begin_date=$(date -d "${begin_date}+1days" +%Y%m%d)
done
echo "finished"
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇spark stream数据处理过程中不要.. 下一篇HDFS:解决HDFS跨版本兼容问题

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目