博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hive开启动态分区,文件压缩
阅读量:3959 次
发布时间:2019-05-24

本文共 1245 字,大约阅读时间需要 4 分钟。

开启动态分区

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

开启压缩

set hive.exec.compress.output=true;set mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec;

开启文件合并默认大小为128M

set hive.merge.tezfiles=true;set hive.merge.smallfiles.avgsize=128000000;set hive.merge.size.per.task=128000000;

创建表

CREATE EXTERNAL TABLE `namespace.tableName`(`字段名称` string COMMENT "描述")PARTITIONED BY (   `ymd` string)ROW FORMAT DELIMITED   FIELDS TERMINATED BY '\u0005' STORED AS INPUTFORMAT   'org.apache.hadoop.mapred.TextInputFormat' OUTPUTFORMAT   'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'LOCATION  'hdfs路径';

查询分区数据写入对应分区

insert into table namespace.tableName partition(分区字段)select 'sms',mktactivitynbr,phonenum as phonecase sms_result when '0' then '1' else '0' end as code,ymdfrom namespace.tableName where ymd>=20210104 and ymd<=20210110 and 字段 in('0','1','23') ;
set hive.exec.dynamic.partition.mode=nonstrict;set hive.exec.dynamic.partition=true;set hive.exec.compress.output=true;set mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec;insert overwrite table dmp_mcc_contact_view partition(ymd) select * from dmp_mcc_contact_view where ymd>=20201127 and ymd<=20201129;

转载地址:http://ximzi.baihongyu.com/

你可能感兴趣的文章
epoll
查看>>
The AnimationClip 'Walk' used by the Animation component 'Pig' must be marked as Legacy.
查看>>
《Linux内核设计与实现》- Linux的进程
查看>>
《Linux内核设计与实现》- 进程的调度
查看>>
inet_ntoa()
查看>>
POSIX消息队列mq_open问题
查看>>
两个数组a[N],b[N],其中A[N]的各个元素值已知,现给b[i]赋值,b[i] = a[0]*a[1]*a[2]…*a[N-1]/a[i];
查看>>
用户态切换到内核态的3种方式
查看>>
笔试常见的智力题(附答案)
查看>>
内核库函数
查看>>
Linux 系统内核空间与用户空间通信的实现与分析
查看>>
linux内核空间和用户空间的区别及交互
查看>>
如何写好应用型学术论文
查看>>
如何查看进程的各种限制
查看>>
64位int类型用printf输出问题
查看>>
网络后台开发面试题目
查看>>
Linux 共享内存限制的查看与设置
查看>>
进程的状态转换
查看>>
如何查看进程的信息(线程数)
查看>>
read的用法
查看>>