栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

hive之核心知识点(三)

hive之核心知识点(三)

1,hive的深入学习:

1.1,hive的表的动态分区:

动态的进行表的分区,能够节约我们的效率,分区的话根据分区字段的值,选好我们需要分区的字段,根据业务需求来分析。

动态分区有几个要点:

1,准备数据:

1,zss,bj2
2,lss,bj
3,tg,sh
4,xg,bj
5,ln,sd
6,yg,sh

2,创建普通表:

create table tb_text(
    id string ,
    name string ,
    city string 
)
row format delimited fields terminated by ','  ;

3,设置开启动态分区(临时的):

set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrick;

4,创建分区表:

create table tb_text(
    id string ,
    name string ,
    city string //city值为:BJ SH ...
)
partitioned by (ct string) ;

5,把数据加载到分区表,根据city字段分区:

1,insert  into  table  tb_text partition(ct)   select  id , name ,city , city as  ct  from  tb_t

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/753312.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号