天翼云代理,天翼云代理商,北京代理商
天翼云折扣专线:400-150-1900(全国市话)

数仓工具之Hive调优

2022-02-21 03:03:53

简介: 1、启用Fetch抓取 2、本地形式(调试运用) 3、表的优化 4、合理设置map数以及reduce数 5、JVM重用 6、紧缩 7、履行方案

第1章 Hive调优
1.1 Fetch抓取(不运用MR)
Fetch抓取是指,Hive中对某些情况的查询能够不用运用MapReduce核算。例如:SELECT * FROM emp;在这种情况下,Hive能够简单地读取emp对应的存储目录下的文件,然后输出查询成果到控制台。
在hive-default.xml.template文件中hive.fetch.task.conversion默许是more,老版别hive默许是minimal,该特点修改为more今后,在大局查找、字段查找、limit查找等都不走mapreduce。

<name>hive.fetch.task.conversionname>
<value>morevalue>Expects one of [none, minimal, more]. Some select queries can be converted to single FETCH task minimizing latency.
  Currently the query should be single sourced not having any subquery and should not have any aggregations or distincts (which incurs RS), lateral views and joins. 0. none : disable hive.fetch.task.conversion 1. minimal : SELECT STAR, FILTER on partition columns, LIMIT only 2. more  : SELECT, FILTER, LIMIT only (support TABLESAMPLE and virtual columns)

1)事例实操:
(1)把hive.fetch.task.conversion设置成none,然后履行查询句子,都会履行mapreduce程序。
hive (default)> set hive.fetch.task.conversion=none;
hive (default)> select * from emp;
hive (default)> select ename from emp;
hive (default)> select ename from emp limit 3;
(2)把hive.fetch.task.conversion设置成more,然后履行查询句子,如下查询办法都不会履行mapreduce程序。
hive (default)> set hive.fetch.task.conversion=more;
hive (default)> select * from emp;
hive (default)> select ename from emp;
hive (default)> select ename from emp limit 3;
1.2 本地形式(调试运用)
大多数的Hadoop Job是需求Hadoop供给的完好的可扩展性来处理大数据集的。不过,有时Hive的输入数据量是十分小的。在这种情况下,为查询触发履行使命耗费的时刻或许会比实践job的履行时刻要多的多。关于大多数这种情况,Hive能够经过本地形式在单台机器上处理一切的使命。关于小数据集,履行时刻能够明显被缩短。
用户能够经过设置hive.exec.mode.local.auto的值为true,来让Hive在恰当的时分主动发动这个优化。
set hive.exec.mode.local.auto=true; //敞开本地mr
//设置local mr的最大输入数据量,当输入数据量小于这个值时选用local mr的办法,默许为134217728,即128M
set hive.exec.mode.local.auto.inputbytes.max=50000000;
//设置local mr的最大输入文件个数,当输入文件个数小于这个值时选用local mr的办法,默许为4
set hive.exec.mode.local.auto.input.files.max=10;
1)事例实操:
(1)敞开本地形式,并履行查询句子
hive (default)> set hive.exec.mode.local.auto=true;
hive (default)> select * from emp cluster by deptno;
Time taken: 1.328 seconds, Fetched: 14 row(s)
(2)关闭本地形式,并履行查询句子
hive (default)> set hive.exec.mode.local.auto=false;
hive (default)> select * from emp cluster by deptno;
Time taken: 20.09 seconds, Fetched: 14 row(s)

1.3 表的优化
1.3.1 小表、大表Join
实践测验发现:新版的hive现已对小表JOIN大表和大表JOIN小表进行了优化。小表放在左面和右边现已没有明显差异。
1.3.2 hive解决数据歪斜
1.空KEY问题
1)空KEY过滤
有时join超时是由于某些key对应的数据太多,而相同key对应的数据都会发送到相同的reducer上,然后导致内存不行。此时咱们应该仔细分析这些反常的key,许多情况下,这些key对应的数据是反常数据,咱们需求在SQL句子中进行过滤。例如key对应的字段为空,操作如下:
事例实操
(1)装备历史服务器
装备mapred-site.xml
mapreduce.jobhistory.address
hadoop102:10020

<name>mapreduce.jobhistory.webapp.addressname> <value>hadoop102:19888value>


发动历史服务器
sbin/mr-jobhistory-daemon.sh start historyserver
检查jobhistory
http://hadoop102:19888/jobhistory
(2)创立空id表
// 创立空id表
create table nullidtable(id bigint, t bigint, uid string, keyword string, url_rank int, click_num int, click_url string) row format delimited fields terminated by '\t';
(3)加载空id数据到空id表中
hive (default)> load data local inpath '/opt/module/hive/datas/nullid' into table nullidtable;
(4)测验不过滤空id
hive (default)> insert overwrite table jointable select n.* from nullidtable n
left join bigtable o on n.id = o.id;
Time taken: 42.038 seconds
Time taken: 37.284 seconds
(5)测验过滤空id
hive (default)> insert overwrite table jointable select n. from (select from nullidtable where id is not null ) n left join bigtable o on n.id = o.id;
Time taken: 31.725 seconds
Time taken: 28.876 seconds
2)空key转换
有时虽然某个key为空对应的数据许多,可是相应的数据不是反常数据,必需求包括在join的成果中,此时咱们能够表a中key为空的字段赋一个随机的值,使得数据随机均匀地分不到不同的reducer上。例如:
事例实操:
不随机散布空null值:
(1)设置5个reduce个数
set mapreduce.job.reduces = 5;
(2)JOIN两张表
insert overwrite table jointable
select n.* from nullidtable n left join bigtable b on n.id = b.id;
成果:如下图所示,能够看出来,呈现了数据歪斜,某些reducer的资源耗费远大于其他reducer。

随机散布空null值
(1)设置5个reduce个数
set mapreduce.job.reduces = 5;
(2)JOIN两张表
insert overwrite table jointable
select n.* from nullidtable n full join bigtable o on
nvl(n.id,rand()) = o.id;
成果:如下图所示,能够看出来,消除了数据歪斜,负载均衡reducer的资源耗费

2 MapJoin
假如不指定MapJoin或许不符合MapJoin的条件,那么Hive解析器会将Join操作转换成Common Join,即:在Reduce阶段完结join。容易发生数据歪斜。能够用MapJoin把小表悉数加载到内存在map端进行join,避免reducer处理。
1)敞开MapJoin参数设置
(1)设置主动选择Mapjoin
set hive.auto.convert.join = true; 默许为true
(2)大表小表的阈值设置(默许25M以下以为是小表):
set hive.mapjoin.smalltable.filesize=25000000;
2)MapJoin工作机制

3)事例实操:
(1)敞开Mapjoin功用
set hive.auto.convert.join = true; 默许为true
(2)履行小表JOIN大表句子
留意:此时小表作为主表,一切数据都要写出去,因而此时会走reduce,mapjoin失效
insert overwrite table jointable
select b.id, b.t, b.uid, b.keyword, b.url_rank, b.click_num, b.click_url
from smalltable s
left join bigtable b
on s.id = b.id;

Time taken: 24.594 seconds
(3)履行大表JOIN小表句子
insert overwrite table jointable
select b.id, b.t, b.uid, b.keyword, b.url_rank, b.click_num, b.click_url
from bigtable b
left join smalltable s
on s.id = b.id;

Time taken: 24.315 seconds
3 Group By
默许情况下,Map阶段同一Key数据分发给一个reduce,当一个key数据过大时就歪斜了。

并不是一切的聚合操作都需求在Reduce端完结,许多聚合操作都能够先在Map端进行部分聚合,终究在Reduce端得出终究成果。
1)敞开Map端聚合参数设置
(1)是否在Map端进行聚合,默许为True
set hive.map.aggr = true
(2)在Map端进行聚合操作的条目数目
set hive.groupby.mapaggr.checkinterval = 100000
(3)有数据歪斜的时分进行负载均衡(默许是false)
set hive.groupby.skewindata = true
当选项设定为 true,生成的查询方案会有两个MR Job。第一个MR Job中,Map的输出成果会随机散布到Reduce中,每个Reduce做部分聚合操作,并输出成果,这样处理的成果是相同的Group By Key有或许被分发到不同的Reduce中,然后到达负载均衡的目的;第二个MR Job再依据预处理的数据成果依照Group By Key散布到Reduce中(这个过程能够确保相同的Group By Key被散布到同一个Reduce中),终究完结终究的聚合操作。
hive (default)> select deptno from emp group by deptno;
Stage-Stage-1: Map: 1 Reduce: 5 Cumulative CPU: 23.68 sec HDFS Read: 19987 HDFS Write: 9 SUCCESS
Total MapReduce CPU Time Spent: 23 seconds 680 msec
OK
deptno
10
20
30
优化今后
hive (default)> set hive.groupby.skewindata = true;
hive (default)> select deptno from emp group by deptno;
Stage-Stage-1: Map: 1 Reduce: 5 Cumulative CPU: 28.53 sec HDFS Read: 18209 HDFS Write: 534 SUCCESS
Stage-Stage-2: Map: 1 Reduce: 5 Cumulative CPU: 38.32 sec HDFS Read: 15014 HDFS Write: 9 SUCCESS
Total MapReduce CPU Time Spent: 1 minutes 6 seconds 850 msec
OK
deptno
10
20
30
1.3.3 Count(Distinct) 去重计算
数据量小的时分无所谓,数据量大的情况下,由于COUNT DISTINCT操作需求用一个Reduce Task来完结,这一个Reduce需求处理的数据量太大,就会导致整个Job很难完结,一般COUNT DISTINCT运用先GROUP BY再COUNT的办法替换,可是需求留意group by形成的数据歪斜问题.
虽然会多用一个Job来完结,但在数据量大的情况下,这个必定是值得的。

1.3.4 笛卡尔积
尽量避免笛卡尔积,join的时分不加on条件,或许无效的on条件,Hive只能运用1个reducer来完结笛卡尔积。
1.3.5 行列过滤
列处理:在SELECT中,只拿需求的列,假如有,尽量运用分区过滤,少用SELECT *。
行处理:在分区取舍中,当运用外相关时,假如将副表的过滤条件写在Where后边,那么就会先全表相关,之后再过滤,比方:
1.3.6 分区
1 分区
引进分区表(需求依据日期对日志进行办理, 经过部门信息模拟)
dept_20200401.log
dept_20200402.log
dept_20200403.log
2)创立分区表语法
hive (default)> create table dept_partition(
deptno int, dname string, loc string
)
partitioned by (day string)
row format delimited fields terminated by '\t';
留意:分区字段不能是表中现已存在的数据,能够将分区字段看作表的伪列。
3)加载数据到分区表中
(1) 数据预备
dept_20200401.log
10 ACCOUNTING 1700
20 RESEARCH 1800
dept_20200402.log
30 SALES 1900
40 OPERATIONS 1700
dept_20200403.log
50 TEST 2000
60 DEV 1900
(2) 加载数据
hive (default)> load data local inpath '/opt/module/hive/datas/dept_20200401.log' into table dept_partition partition(day='20200401');
hive (default)> load data local inpath '/opt/module/hive/datas/dept_20200402.log' into table dept_partition partition(day='20200402');
hive (default)> load data local inpath '/opt/module/hive/datas/dept_20200403.log' into table dept_partition partition(day='20200403');
留意:分区表加载数据时,有必要指定分区

图 分区表
4)查询分区表中数据
单分区查询
hive (default)> select * from dept_partition where day='20200401';
多分区联合查询
hive (default)> select * from dept_partition where day='20200401'

union select * from dept_partition where day='20200402' union select * from dept_partition where day='20200403';

hive (default)> select * from dept_partition where day='20200401' or

day='20200402' or day='20200403' ;

5)检查分区表有多少分区
hive> show partitions dept_partition;
6)增加分区
创立单个分区
hive (default)> alter table dept_partition add partition(day='20200404') ;
一起创立多个分区(分区之间不能有逗号)
hive (default)> alter table dept_partition add partition(day='20200405') partition(day='20200406');
7)删去分区
删去单个分区
hive (default)> alter table dept_partition drop partition (day='20200406');
一起删去多个分区(分区之间有必要有逗号)
hive (default)> alter table dept_partition drop partition (day='20200404'), partition(day='20200405');
8)检查分区表结构
hive> desc formatted dept_partition;

Partition Information

col_name data_type comment

month string
2 分区表二级分区
考虑: 怎么一天的日志数据量也很大,怎么再将数据拆分?
1)创立二级分区表
hive (default)> create table dept_partition2(

deptno int, dname string, loc string )
           partitioned by (day string, hour string)
           row format delimited fields terminated by '\t';

2)正常的加载数据
(1)加载数据到二级分区表中
hive (default)> load data local inpath '/opt/module/hive/datas/dept_20200401.log' into table
dept_partition2 partition(day='20200401', hour='12');
(2)查询分区数据
hive (default)> select * from dept_partition2 where day='20200401' and hour='12';
3)把数据直接上传到分区目录上,让分区表和数据发生相关的三种办法
(1)办法一:上传数据后修正
上传数据
hive (default)> dfs -mkdir -p
/user/hive/warehouse/db_hive.db/dept_partition2/day=20200401/hour=13;
hive (default)> dfs -put /opt/module/datas/dept_20200401.log /user/hive/warehouse/db_hive.db/dept_partition2/day=20200401/hour=13;
查询数据(查询不到刚上传的数据)
hive (default)> select * from dept_partition2 where day='20200401' and hour='13';
履行修正命令
hive> msck repair table dept_partition2;
再次查询数据
hive (default)> select * from dept_partition2 where day='20200401' and hour='13';
(2)办法二:上传数据后增加分区
上传数据
hive (default)> dfs -mkdir -p
/user/hive/warehouse/db_hive.db/dept_partition2/day=20200401/hour=14;
hive (default)> dfs -put /opt/module/hive/datas/dept_20200401.log /user/hive/warehouse/db_hive.db/dept_partition2/day=20200401/hour=14;
履行增加分区

hive (default)> alter table dept_partition2 add partition(day='20200401',hour='14');

查询数据
hive (default)> select * from dept_partition2 where day='20200401' and hour='14';
(3)办法三:创立文件夹后load数据到分区
创立目录
hive (default)> dfs -mkdir -p
/user/hive/warehouse/db_hive.db/dept_partition2/day=20200401/hour=15;
上传数据
hive (default)> load data local inpath '/opt/module/hive/datas/dept_20200401.log' into table
dept_partition2 partition(day='20200401',hour='15');
查询数据
hive (default)> select * from dept_partition2 where day='20200401' and hour='15';
3 动态分区调整
联系型数据库中,对分区表Insert数据时分,数据库主动会依据分区字段的值,将数据刺进到相应的分区中,Hive中也供给了类似的机制,即动态分区(Dynamic Partition),只不过,运用Hive的动态分区,需求进行相应的装备。
1)开发动态分区参数设置
(1)开发动态分区功用(默许true,敞开)
hive.exec.dynamic.partition=true
(2)设置为非严厉形式(动态分区的形式,默许strict,表明有必要指定至少一个分区为静态分区,nonstrict形式表明允许一切的分区字段都能够运用动态分区。)
hive.exec.dynamic.partition.mode=nonstrict
(3)在一切履行MR的节点上,最大总共能够创立多少个动态分区。默许1000
hive.exec.max.dynamic.partitions=1000
(4)在每个履行MR的节点上,最大能够创立多少个动态分区。该参数需求依据实践的数据来设定。比方:源数据中包括了一年的数据,即day字段有365个值,那么该参数就需求设置成大于365,假如运用默许值100,则会报错。
hive.exec.max.dynamic.partitions.pernode=100
(5)整个MR Job中,最大能够创立多少个HDFS文件。默许100000
hive.exec.max.created.files=100000
(6)当有空分区生成时,是否抛出反常。一般不需求设置。默许false
hive.error.on.empty.partition=false
2)事例实操
需求:将dept表中的数据依照地区(loc字段),刺进到方针表dept_partition的相应分区中。
(1)创立方针分区表
hive (default)> create table dept_partition_dy(id int, name string) partitioned by (loc int) row format delimited fields terminated by '\t';

(2)设置动态分区
set hive.exec.dynamic.partition.mode = nonstrict;
hive (default)> insert into table dept_partition_dy partition(loc) select deptno, dname, loc from dept;
(3)检查方针分区表的分区情况
hive (default)> show partitions dept_partition_dy;
考虑:方针分区表是怎么匹配到分区字段的?
4 分桶表
分区供给一个隔离数据和优化查询的便当办法。不过,并非一切的数据集都可形成合理的分区。关于一张表或许分区,Hive 能够进一步组织成桶,也便是更为细粒度的数据范围区分。
分桶是将数据集分解成更容易办理的若干部分的另一个技能。
分区针对的是数据的存储途径;分桶针对的是数据文件。
1)先创立分桶表,经过直接导入数据文件的办法
(1)数据预备
1001 ss1
1002 ss2
1003 ss3
1004 ss4
1005 ss5
1006 ss6
1007 ss7
1008 ss8
1009 ss9
1010 ss10
1011 ss11
1012 ss12
1013 ss13
1014 ss14
1015 ss15
1016 ss16
(2)创立分桶表
create table stu_buck(id int, name string)
clustered by(id)
into 4 buckets
row format delimited fields terminated by '\t';
(3)检查表结构
hive (default)> desc formatted stu_buck;
Num Buckets: 4
(4)导入数据到分桶表中(hive新版别load数据跑mr,因而要改用hdfs途径导数据)
hive (default)> load data local inpath '/opt/module/hive/datas/student.txt' into table stu_buck;
(5)检查创立的分桶表中是否分红4个桶
检查hdfs(http://hadoop102:9870)
(6)查询分桶的数据
hive(default)> select * from stu_buck;
分桶规则:
依据成果可知:Hive的分桶选用对分桶字段的值进行哈希,然后除以桶的个数求余的办法决议该条记载存放在哪个桶傍边
1.4 合理设置Map及Reduce数
1)一般情况下,作业会经过input的目录发生一个或许多个map使命。
主要的决议因素有:input的文件总个数,input的文件巨细,集群设置的文件块巨细。
2)是不是map数越多越好?
答案是否定的。假如一个使命有许多小文件(远远小于块巨细128m),则每个小文件也会被当做一个块,用一个map使命来完结,而一个map使命发动和初始化的时刻远远大于逻辑处理的时刻,就会形成很大的资源浪费。并且,一起可履行的map数是受限的。
3)是不是确保每个map处理接近128m的文件块,就高枕无忧了?
答案也是不一定。比方有一个127m的文件,正常会用一个map去完结,但这个文件只有一个或许两个小字段,却有几千万的记载,假如map处理的逻辑比较复杂,用一个map使命去做,必定也比较耗时。
针对上面的问题2和3,咱们需求采取两种办法来解决:即削减map数和增加map数;
1.4.1 复杂文件增加Map数
当input的文件都很大,使命逻辑复杂,map履行十分慢的时分,能够考虑增加Map数,来使得每个map处理的数据量削减,然后进步使命的履行效率。
增加map的办法为:依据
computeSliteSize(Math.max(minSize,Math.min(maxSize,blocksize)))=blocksize=128M公式,调整maxSize最大值。让maxSize最大值低于blocksize就能够增加map的个数。
事例实操:
1)履行查询
hive (default)> select count(*) from emp;
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2)设置最大切片值为100个字节
hive (default)> set mapreduce.input.fileinputformat.split.maxsize=100;
hive (default)> select count(*) from emp;
Hadoop job information for Stage-1: number of mappers: 6; number of reducers: 1
1.4.2 小文件进行兼并
1)在map履行前兼并小文件,削减map数:CombineHiveInputFormat具有对小文件进行兼并的功用(体系默许的格局)。HiveInputFormat没有对小文件兼并功用。
set hive.input.format= org.apache.hadoop.hive.ql.io.CombineHiveInputFormat;
2)在Map-Reduce的使命结束时兼并小文件的设置:
在map-only使命结束时兼并小文件,默许true
SET hive.merge.mapfiles = true;
在map-reduce使命结束时兼并小文件,默许false
SET hive.merge.mapredfiles = true;
兼并文件的巨细,默许256M
SET hive.merge.size.per.task = 268435456;
当输出文件的平均巨细小于该值时,发动一个独立的map-reduce使命进行文件merge
SET hive.merge.smallfiles.avgsize = 16777216;
1.4.3 合理设置Reduce数
1)调整reduce个数办法一
(1)每个Reduce处理的数据量默许是256MB
hive.exec.reducers.bytes.per.reducer=256000000
(2)每个使命最大的reduce数,默许为1009
hive.exec.reducers.max=1009
(3)核算reducer数的公式
N=min(参数2,总输入数据量/参数1)
2)调整reduce个数办法二
在hadoop的mapred-default.xml文件中修改
设置每个job的Reduce个数
set mapreduce.job.reduces = 15;
3)reduce个数并不是越多越好
(1)过多的发动和初始化reduce也会耗费时刻和资源;
(2)另外,有多少个reduce,就会有多少个输出文件,假如生成了许多个小文件,那么假如这些小文件作为下一个使命的输入,则也会呈现小文件过多的问题;
在设置reduce个数的时分也需求考虑这两个原则:处理大数据量利用适宜的reduce数;使单个reduce使命处理数据量巨细要适宜;
1.5 并行履行
Hive会将一个查询转化成一个或许多个阶段。这样的阶段能够是MapReduce阶段、抽样阶段、兼并阶段、limit阶段。或许Hive履行过程中或许需求的其他阶段。默许情况下,Hive一次只会履行一个阶段。不过,某个特定的job或许包括很多的阶段,而这些阶段或许并非完全互相依靠的,也便是说有些阶段是能够并行履行的,这样或许使得整个job的履行时刻缩短。不过,假如有更多的阶段能够并行履行,那么job或许就越快完结。
经过设置参数hive.exec.parallel值为true,就能够敞开并发履行。不过,在共享集群中,需求留意下,假如job中并行阶段增多,那么集群利用率就会增加。
set hive.exec.parallel=true; //翻开使命并行履行,默许为false
set hive.exec.parallel.thread.number=16; //同一个sql允许最大并行度,默许为8。
当然,得是在体系资源比较空闲的时分才有优势,不然,没资源,并行也起不来。
1.6 严厉形式
Hive能够经过设置避免一些风险操作:
1)分区表不运用分区过滤
将hive.strict.checks.no.partition.filter设置为true时,关于分区表,除非where句子中含有分区字段过滤条件来约束范围,不然不允许履行。换句话说,便是用户不允许扫描一切分区。进行这个约束的原因是,一般分区表都拥有十分大的数据集,并且数据增加迅速。没有进行分区约束的查询或许会耗费令人不行承受的巨大资源来处理这个表。
2)运用order by没有limit过滤
将hive.strict.checks.orderby.no.limit设置为true时,关于运用了order by句子的查询,要求有必要运用limit句子。由于order by为了履行排序过程会将一切的成果数据分发到同一个Reducer中进行处理,强制要求用户增加这个LIMIT句子能够避免Reducer额外履行很长一段时刻。
3)笛卡尔积
将hive.strict.checks.cartesian.product设置为true时,会约束笛卡尔积的查询。对联系型数据库十分了解的用户或许期望在 履行JOIN查询的时分不运用ON句子而是运用where句子,这样联系数据库的履行优化器就能够高效地将WHERE句子转化成那个ON句子。不幸的是,Hive并不会履行这种优化,因而,假如表足够大,那么这个查询就会呈现不行控的情况。
1.7 JVM重用
1) 敞开uber形式,完成jvm重用。默许情况下,每个Task使命都需求发动一个jvm来运行,假如Task使命核算的数据量很小,咱们能够让同一个Job的多个Task运行在一个Jvm中,不用为每个Task都敞开一个Jvm.
敞开uber形式,在mapred-site.xml中增加如下装备


mapreduce.job.ubertask.enable
true


mapreduce.job.ubertask.maxmaps
9


mapreduce.job.ubertask.maxreduces
1


mapreduce.job.ubertask.maxbytes

1.8 紧缩
要在Hadoop中启用紧缩,能够装备如下参数(mapred-site.xml文件中):
参数 默许值 阶段 建议
io.compression.codecs
(在core-site.xml中装备) org.apache.hadoop.io.compress.DefaultCodec, org.apache.hadoop.io.compress.GzipCodec, org.apache.hadoop.io.compress.BZip2Codec,
org.apache.hadoop.io.compress.Lz4Codec 输入紧缩 Hadoop运用文件扩展名判断是否支持某种编解码器
mapreduce.map.output.compress false mapper输出 这个参数设为true启用紧缩
mapreduce.map.output.compress.codec org.apache.hadoop.io.compress.DefaultCodec mapper输出 运用LZO、LZ4或snappy编解码器在此阶段紧缩数据
mapreduce.output.fileoutputformat.compress false reducer输出 这个参数设为true启用紧缩
mapreduce.output.fileoutputformat.compress.codec org.apache.hadoop.io.compress. DefaultCodec reducer输出 运用标准东西或许编解码器,如gzip和bzip2
mapreduce.output.fileoutputformat.compress.type RECORD reducer输出 SequenceFile输出运用的紧缩类型:NONE和BLOCK

1.9 履行方案(Explain)
1)根本语法
EXPLAIN [EXTENDED | DEPENDENCY | AUTHORIZATION] query
2)事例实操
(1)检查下面这条句子的履行方案
hive (default)> explain select * from emp;
hive (default)> explain select deptno, avg(sal) avg_sal from emp group by deptno;
(2)检查详细履行方案
hive (default)> explain extended select * from emp;
hive (default)> explain extended select deptno, avg(sal) avg_sal from emp group by deptno;


12年经验 · 提供上云保障

服务热线:132-6161-6125(手机) 400-150-1900(全国市话)

站内导航: 天翼云服务器价格| 天翼云购买流程| 天翼云代理| 北京天翼云代理商| 杭州天翼云代理| 深圳天翼云代理商| 钉钉代理商| 阿里云代理| 公司官网

我公司收款账号| 天翼云备案系统

CopyRight © 2019 天翼云代理商. All Rights Reserved 京ICP备11011846号-15 管理-北京志远天辰科技有限公司