- 浏览: 343654 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
lvyuan1234:
你好,你那个sample.txt文件可以分享给我吗
hive insert overwrite into -
107x:
不错,谢谢!
hive 表的一些默认值 -
on_way_:
赞
Hadoop相关书籍 -
bupt04406:
dengkanghua 写道出来这个问题该怎么解决?hbase ...
Unexpected state导致HMaster abort -
dengkanghua:
出来这个问题该怎么解决?hbase master启动不起来。
Unexpected state导致HMaster abort
ExecReducer{
private boolean isTagged = false;
@Override
public void configure(JobConf job) {
MapredWork gWork = Utilities.getMapRedWork(job);
isTagged = gWork.getNeedsTagging(); //初始化
}
}
//只有在reducer是JoinOperator.class的时候才会设置needsTagging为true
org.apache.hadoop.hive.ql.plan.MapredWork
public void setNeedsTagging(boolean needsTagging) {
this.needsTagging = needsTagging;
}
if (reducer.getClass() == JoinOperator.class) {
plan.setNeedsTagging(true);
}
org.apache.hadoop.hive.ql.exec.ExecReducer.reduce(Object key, Iterator values, OutputCollector output,
Reporter reporter){
BytesWritable keyWritable = (BytesWritable) key;
tag.set((byte) 0); //默认tag为0
if (isTagged) { // tag上了
// remove the tag
int size = keyWritable.getSize() - 1; // keyWritable的长度
tag.set(keyWritable.get()[size]); //最后一个byte是tag的值。
keyWritable.setSize(size);
}
}
join1.q.out:在一个MR中计算两个表的join,tag为0,1,在reduce阶段就可以区分一个row是来自哪个table。
EXPLAIN
FROM src src1 JOIN src src2 ON (src1.key = src2.key)
INSERT OVERWRITE TABLE dest_j1 SELECT src1.key, src2.value
STAGE DEPENDENCIES:
Stage-1 is a root stage
Stage-0 depends on stages: Stage-1
STAGE PLANS:
Stage: Stage-1
Map Reduce
Alias -> Map Operator Tree:
src1
TableScan
alias: src1
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 0
value expressions:
expr: key
type: string
src2
TableScan
alias: src2
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 1
value expressions:
expr: value
type: string
Reduce Operator Tree:
Join Operator
condition map:
Inner Join 0 to 1
condition expressions:
0 {VALUE._col0}
1 {VALUE._col1}
handleSkewJoin: false
outputColumnNames: _col0, _col3
Select Operator
expressions:
expr: _col0
type: string
expr: _col3
type: string
outputColumnNames: _col0, _col1
Select Operator
expressions:
expr: UDFToInteger(_col0)
type: int
expr: _col1
type: string
outputColumnNames: _col0, _col1
File Output Operator
compressed: false
GlobalTableId: 1
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: dest_j1
Stage: Stage-0
Move Operator
tables:
replace: true
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: dest_j1
join3.q.out:在一个MR中计算三个表的Join,tag为0,1,2,在reduce阶段就可以区分一个row是来自哪个table。
EXPLAIN
FROM src src1 JOIN src src2 ON (src1.key = src2.key) JOIN src src3 ON (src1.key = src3.key)
INSERT OVERWRITE TABLE dest1 SELECT src1.key, src3.value
STAGE DEPENDENCIES:
Stage-1 is a root stage
Stage-0 depends on stages: Stage-1
STAGE PLANS:
Stage: Stage-1
Map Reduce
Alias -> Map Operator Tree:
src1
TableScan
alias: src1
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 0
value expressions:
expr: key
type: string
src2
TableScan
alias: src2
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 1
src3
TableScan
alias: src3
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 2
value expressions:
expr: value
type: string
Reduce Operator Tree:
Join Operator
condition map:
Inner Join 0 to 1
Inner Join 0 to 2
condition expressions:
0 {VALUE._col0}
1
2 {VALUE._col1}
handleSkewJoin: false
outputColumnNames: _col0, _col5
Select Operator
expressions:
expr: _col0
type: string
expr: _col5
type: string
outputColumnNames: _col0, _col1
Select Operator
expressions:
expr: UDFToInteger(_col0)
type: int
expr: _col1
type: string
outputColumnNames: _col0, _col1
File Output Operator
compressed: false
GlobalTableId: 1
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: dest1
Stage: Stage-0
Move Operator
tables:
replace: true
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: dest1
private boolean isTagged = false;
@Override
public void configure(JobConf job) {
MapredWork gWork = Utilities.getMapRedWork(job);
isTagged = gWork.getNeedsTagging(); //初始化
}
}
//只有在reducer是JoinOperator.class的时候才会设置needsTagging为true
org.apache.hadoop.hive.ql.plan.MapredWork
public void setNeedsTagging(boolean needsTagging) {
this.needsTagging = needsTagging;
}
if (reducer.getClass() == JoinOperator.class) {
plan.setNeedsTagging(true);
}
org.apache.hadoop.hive.ql.exec.ExecReducer.reduce(Object key, Iterator values, OutputCollector output,
Reporter reporter){
BytesWritable keyWritable = (BytesWritable) key;
tag.set((byte) 0); //默认tag为0
if (isTagged) { // tag上了
// remove the tag
int size = keyWritable.getSize() - 1; // keyWritable的长度
tag.set(keyWritable.get()[size]); //最后一个byte是tag的值。
keyWritable.setSize(size);
}
}
join1.q.out:在一个MR中计算两个表的join,tag为0,1,在reduce阶段就可以区分一个row是来自哪个table。
EXPLAIN
FROM src src1 JOIN src src2 ON (src1.key = src2.key)
INSERT OVERWRITE TABLE dest_j1 SELECT src1.key, src2.value
STAGE DEPENDENCIES:
Stage-1 is a root stage
Stage-0 depends on stages: Stage-1
STAGE PLANS:
Stage: Stage-1
Map Reduce
Alias -> Map Operator Tree:
src1
TableScan
alias: src1
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 0
value expressions:
expr: key
type: string
src2
TableScan
alias: src2
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 1
value expressions:
expr: value
type: string
Reduce Operator Tree:
Join Operator
condition map:
Inner Join 0 to 1
condition expressions:
0 {VALUE._col0}
1 {VALUE._col1}
handleSkewJoin: false
outputColumnNames: _col0, _col3
Select Operator
expressions:
expr: _col0
type: string
expr: _col3
type: string
outputColumnNames: _col0, _col1
Select Operator
expressions:
expr: UDFToInteger(_col0)
type: int
expr: _col1
type: string
outputColumnNames: _col0, _col1
File Output Operator
compressed: false
GlobalTableId: 1
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: dest_j1
Stage: Stage-0
Move Operator
tables:
replace: true
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: dest_j1
join3.q.out:在一个MR中计算三个表的Join,tag为0,1,2,在reduce阶段就可以区分一个row是来自哪个table。
EXPLAIN
FROM src src1 JOIN src src2 ON (src1.key = src2.key) JOIN src src3 ON (src1.key = src3.key)
INSERT OVERWRITE TABLE dest1 SELECT src1.key, src3.value
STAGE DEPENDENCIES:
Stage-1 is a root stage
Stage-0 depends on stages: Stage-1
STAGE PLANS:
Stage: Stage-1
Map Reduce
Alias -> Map Operator Tree:
src1
TableScan
alias: src1
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 0
value expressions:
expr: key
type: string
src2
TableScan
alias: src2
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 1
src3
TableScan
alias: src3
Reduce Output Operator
key expressions:
expr: key
type: string
sort order: +
Map-reduce partition columns:
expr: key
type: string
tag: 2
value expressions:
expr: value
type: string
Reduce Operator Tree:
Join Operator
condition map:
Inner Join 0 to 1
Inner Join 0 to 2
condition expressions:
0 {VALUE._col0}
1
2 {VALUE._col1}
handleSkewJoin: false
outputColumnNames: _col0, _col5
Select Operator
expressions:
expr: _col0
type: string
expr: _col5
type: string
outputColumnNames: _col0, _col1
Select Operator
expressions:
expr: UDFToInteger(_col0)
type: int
expr: _col1
type: string
outputColumnNames: _col0, _col1
File Output Operator
compressed: false
GlobalTableId: 1
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: dest1
Stage: Stage-0
Move Operator
tables:
replace: true
table:
input format: org.apache.hadoop.mapred.TextInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: dest1
发表评论
-
hive rename table name
2013-09-18 14:28 2526hive rename tablename hive re ... -
hive的distribute by如何partition long型的数据
2013-08-20 10:15 2422有用户问:hive的distribute by分桶是怎么分 ... -
hive like vs rlike vs regexp
2013-04-11 18:53 11169like vs rlike vs regexp r ... -
hive sql where条件很简单,但是太多
2012-07-18 15:51 8692insert overwrite table aaaa ... -
insert into时(string->bigint)自动类型转换
2012-06-14 12:30 8240原表src: hive> desc src; ... -
通过复合结构来优化udf的调用
2012-05-11 14:07 1175select split("accba&quo ... -
RegexSerDe
2012-03-14 09:58 1514官方示例在: https://cwiki.apache.or ... -
Hive 的 OutputCommitter
2012-01-30 19:44 1777Hive 的 OutputCommitter publi ... -
hive LATERAL VIEW 行转列
2011-11-09 14:49 5395drop table lateralview; create ... -
hive complex type
2011-11-08 19:56 1319数据: 1,100|3,20|2,70|5,100 建表: ... -
hive转义字符
2011-10-25 16:41 6191CREATE TABLE escape (id STRING, ... -
hive 两个不同类型的columns进行比较
2011-09-19 13:46 2985select case when "ab1234&q ... -
lateral view
2011-09-18 04:04 0lateral view与udtf相关 -
udf 中获得 FileSystem
2011-09-14 10:28 0在udf中获得FileSystem,需要获得知道fs.defa ... -
hive union mapjoin
2011-09-09 16:29 0union union.q union2.q ... -
hive eclipse
2011-09-08 17:42 0eclipse-templates$ vi .classpat ... -
hive join filter
2011-09-07 23:05 0join16.q.out hive.optimize.ppd ... -
hive limit
2011-09-07 21:02 0limit 关键字: input4_limit.q.out ... -
hive convertMapJoin MapJoinProcessor
2011-09-06 21:17 0join25.q join26 ... -
hive hive.merge.mapfiles hive.merge.mapredfiles
2011-09-06 19:14 0HiveConf: HIVEMERGEMAPFILES ...
相关推荐
hive hive hive hive hive hive hive hive hive hive hive hive
使用hive3.1.2和spark3.0.0配置hive on spark的时候,发现官方下载的hive3.1.2和spark3.0.0不兼容,hive3.1.2对应的版本是spark2.3.0,而spark3.0.0对应的hadoop版本是hadoop2.6或hadoop2.7。 所以,如果想要使用高...
hive-jdbc
1 Hive 概念与连接使用: 2 2 Hive支持的数据类型: 2 2.1原子数据类型: 2 2.2复杂数据类型: 2 2.3 Hive类型转换: 3 3 Hive创建/删除数据库 3 3.1创建数据库: 3 3.2 删除数据库: 3 4 Hive 表相关语句 3 4.1 Hive ...
Hive表生成工具,Hive表生成工具Hive表生成工具
《Hive数据仓库案例教程》教学课件 第5章 Hive数据操作.pdf《Hive数据仓库案例教程》教学课件 第5章 Hive数据操作.pdf《Hive数据仓库案例教程》教学课件 第5章 Hive数据操作.pdf《Hive数据仓库案例教程》教学课件 第...
Hive.sql
Hive是一个基于Hadoop的数据仓库工具,它本身并不存储数据,部署在Hadoop集群上,数据是存储在HDFS上的. Hive所建的表在HDFS上对应的是一个文件夹,表的内容对应的是一个文件。它不仅可以存储大量的数据而且可以对...
Hive原理/Hive SQL/Hive 函数/数据仓库分层和建模/Hive sql优化/数据倾斜
Hive是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并提供类SQL查询功能。 hive是基于Hadoop的一个数据仓库工具,用来进行数据提取、转化、加载,这是一种可以存储、查询和分析存储...
Ambari下Hive3.0升级到Hive4.0,验证自测;
5.安装hive和mysq完成后,将mysql的连接jar包拷贝到$HIVE_HOME/lib目录下 如果出现没有权限的问题,在mysql授权(在安装mysql的机器上执行) mysql -uroot -p #(执行下面的语句 *.*:所有库下的所有表 %:任何IP地址...
Hive优化方法整理 hive 数据倾斜 内连接
利用Hive进行复杂用户行为大数据分析及优化案例(全套视频+课件+代码+讲义+工具软件),具体内容包括: 01_自动批量加载数据到hive 02_Hive表批量加载数据的脚本实现(一) 03_Hive表批量加载数据的脚本实现(二) ...
由于 Hive 采用了类似SQL 的查询语言 HQL(Hive Query Language),因此很容易将 Hive 理解为数据库。其实从结构上来看,Hive 和数据库除了拥有类似的查询语言,再无类似之处。本文将从多个方面来阐述 Hive ...
hive造数据
hive数仓、hive SQL 、 hive自定义函数 、hive参数深入浅出
HIVE安装及详解,及测试,该文档版本是1.2+的。。。。。
hive介绍和hive环境搭建。。一、 安装mysql 1. 使用root用户: su root 2. 安装 yum install mysql yum install mysql-server yum install mysql-devel(可选) 3. 修改配置信息,添加: vim /etc/my.cnf ...