hive表指定分区字段搜索_hive使用技艺(一)自动化动态分配表分区及修改hive表字段名称...

本文介绍了如何在Hive中实现自动化动态分配表分区,并提供了修改表字段名称的方法。通过设置`hive.exec.dynamic.partition.mode=nonstrict`允许动态分区,利用时间字段创建分区。同时展示了创建新表并重新分配数据到分区,以及快速为表添加多个分区的操作步骤。
摘要由CSDN通过智能技术生成

hive使用技巧(一)自动化动态分配表分区及修改hive表字段名称

Author:FuRenjie kwu

1、自动化动态分配表分区

set hive.exec.dynamic.partition.mode=nonstrict;

insert overwrite table ods.fund2hundsunlg PARTITION(day)

select distinct fromHostIp ,hundsunNodeIp,concat(substring(requestTime,0,10),' ', substring(requestTime,12,8)) , httpStatus ,responseTimes,urlpath, responseCharts ,postBody,

concat(substring(requestTime,0,4),substring(requestTime,6,2), substring(requestTime,9,2)) as day

from ods.fund2hundsunlog  ;

说明:

1)set

hive.exec.dynamic.partition.mode=nonstrict; 设置表分区可动态加载

2)concat(substring(requestTime,0,4),substring(requestTime,6,2),

substring(requestTime,9,2)) as day,根据已有时间的切分来做partition

2、快速修改hive表字段名称

1)  重新创建新表

drop table ods.dratio;

create EXTERNAL table ods.dratio (

dratioId string comment "用户ID:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值