• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
导航菜单
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx
您的位置:首页 > 服务器 >云计算 > hive使用技巧(一)自动化动态分配表分区及修改hive表字段名称,使用技巧hive

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

作者:网友 字体:[增加 减小] 来源:互联网

本文主要包含hive使用技巧(一)自动化动态分配表分区及修改hive表字段名称,使用技巧hive等服务器相关知识,网友希望可以进行参考

hive使用技巧(一)自动化动态分配表分区及修改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:用户ID:860010-2370010130,注册用户ID:860010-2370010131",
cookieId string comment "mcookie",
sex string comment "sex: 1 男, 2 女",
age string comment "age: 1 0-18, 2 19-29, 3 30-39, 4 40以上",
ppt string comment "ppt: 1 高购买力 2 中购买力 3 低购买力",
degree string comment "degree: 1 本科以下 2 本科及其以上",
favor string comment "喜好信息(不定长)", 
commercial string comment "商业价值信息(不定长)"
)
comment "用户行为分析"
partitioned by(day string comment "按天的分区表字段")
STORED AS TEXTFILE 
location '/dw/ods/dratio';

2)重新分配表分区的数据,无须数据移动
alter table ods.dratio add partition(day='20150507') location '/dw/ods/dratio/day=20150507';
alter table ods.dratio add partition(day='20150508') location '/dw/ods/dratio/day=20150508';
alter table ods.dratio add partition(day='20150509') location '/dw/ods/dratio/day=20150509';
alter table ods.dratio add partition(day='20150510') location '/dw/ods/dratio/day=20150510';
alter table ods.dratio add partition(day='20150511') location '/dw/ods/dratio/day=20150511';
alter table ods.dratio add partition(day='20150512') location '/dw/ods/dratio/day=20150512';
alter table ods.dratio add partition(day='20150513') location '/dw/ods/dratio/day=20150513';
alter table ods.dratio add partition(day='20150514') location '/dw/ods/dratio/day=20150514';
alter table ods.dratio add partition(day='20150515') location '/dw/ods/dratio/day=20150515';
alter table ods.dratio add partition(day='20150516') location '/dw/ods/dratio/day=20150516';
alter table ods.dratio add partition(day='20150517') location '/dw/ods/dratio/day=20150517';
alter table ods.dratio add partition(day='20150518') location '/dw/ods/dratio/day=20150518';
alter table ods.dratio add partition(day='20150519') location '/dw/ods/dratio/day=20150519';
alter table ods.dratio add partition(day='20150520') location '/dw/ods/dratio/day=20150520';
alter table ods.dratio add partition(day='20150521') location '/dw/ods/dratio/day=20150521';


分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

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

相关文章

  • Spark MLlib Deep Learning Convolution Neural Network (深度学习-卷积神经网络)3.3,mllibconvolution
  • Linux配置时间服务器,linux配置服务器
  • R720 disable hyperthreading,r720hyperthreading
  • 【Spark】配置Spark源码阅读环境,spark源码阅读环境
  • 当代数学七大难题,当代七大难题
  • hive 日志存放位置修改,hive日志存放位置
  • libvirt 部分API 介绍,libvirtapi
  • A Note on Distributed Computing,anoteondialectic
  • 推荐引擎mahout安装与配置,引擎mahout配置
  • Hadoop之—— CentOS Warning: $HADOOP_HOME is deprecated解决方案,hadoopdeprecated

文章分类

  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx

最近更新的内容

    • 启动hive报错[ERROR] Terminal initialization failed; falling back to unsupported,hiveunsupported
    • Java服务端限制下载速度,java服务端下载速度
    • Hadoop常见重要命令行操作及命令作用,hadoop命令行命令
    • MapReduce程序之实现单表关联,mapreduce单表关联
    • 1006-hive的自定义UDF函数,1006-hiveudf函数
    • 云计算: ERP未来必然趋势,erp未来
    • Elasticsearch之Nested Sorting,elasticsearch
    • 什么是OpenStack,OpenStack
    • chinapub读书会第4期:企业级大数据应用与实践,chinapub读书会
    • libvirt 部分API 介绍,libvirtapi

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有