HDP Hive StorageHandler 下推优化的坑
关键词:hdp , hive , StorageHandler
了解Hive StorageHandler的同学都知道,StorageHandler作为Hive适配不同存储的拓展类,同时肩负着HiveStoragePredicateHandler的角色对相关存储做下推优化,核心方法如下:
/**
* HiveStoragePredicateHandler is an optional companion to {@link
* HiveStorageHandler}; it should only be implemented by handlers which
* support decomposition of predicates being pushed down into table scans.
*/
public interface HiveStoragePredicateHandler { /**
* Gives the storage handler a chance to decompose a predicate. The storage
* handler should analyze the predicate and return the portion of it which
* cannot be evaluated during table access. For example, if the original
* predicate is <code>x = 2 AND upper(y)='YUM'</code>, the storage handler
* might be able to handle <code>x = 2</code> but leave the "residual"
* <code>upper(y)='YUM'</code> for Hive to deal with. The breakdown
* need not be non-overlapping; for example, given the
* predicate <code>x LIKE 'a%b'</code>, the storage handler might
* be able to evaluate the prefix search <code>x LIKE 'a%'</code>, leaving
* <code>x LIKE '%b'</code> as the residual.
*
* @param jobConf contains a job configuration matching the one that
* will later be passed to getRecordReader and getSplits
*
* @param deserializer deserializer which will be used when
* fetching rows
*
* @param predicate predicate to be decomposed
*
* @return decomposed form of predicate, or null if no pushdown is
* possible at all
*/
public DecomposedPredicate decomposePredicate(
JobConf jobConf,
Deserializer deserializer,
ExprNodeDesc predicate); /**
* Struct class for returning multiple values from decomposePredicate.
*/
public static class DecomposedPredicate {
/**
* Portion of predicate to be evaluated by storage handler. Hive
* will pass this into the storage handler's input format.
*/
public ExprNodeGenericFuncDesc pushedPredicate; /**
* Serialized format for filter
*/
public Serializable pushedPredicateObject; /**
* Portion of predicate to be post-evaluated by Hive for any rows
* which are returned by storage handler.
*/
public ExprNodeGenericFuncDesc residualPredicate;
}
}
核心方法便是decomposePredicate方法,返回一个 DecomposePredicate 对象,其中,对象中的属性成员 Serializable pushedPredicateObject 是一个自由度非常高的属性,你可以把你任何下推的结果、配置、甚至在下推中解析表达树得到的一些函数声明等都可以传递出去,给到InputFormat侧去决定如何读取数据。但是在HDP 2.2.6-2800(对应Hive 0.14.0.2.2.6-2800)和 HDP 2.4.2.0-258 (对应 Hive 1.2.1000.2.4.2.0-258) 中,经测试,DecomposePredicate的另外两个属性都能起效,唯独pushedPredicateObject怎么都拿不到,在InputFormat侧一直为null。
单步跟了Hive 0.14.0.2.2.6.0的源码,pushedPredicateObject测试能用,本地打包上传测试服务器替换原来的hive-exec jar包重启HiveServer2,居然也测试成功能用。由于HDP的代码小版本号太多,而且也不确定后面横线后的版本号对应的数字是代表什么意思(revision?),所以暂时找不到确定的源码了,认为最近似的源码2.2.6.0手动编译打包的是没问题的。
只能姑且认为是HDP的一个莫名的坑,有基于HDP的Hive做下推优化的同学需要留意一下这个问题。
HDP Hive StorageHandler 下推优化的坑的更多相关文章
- MySQL--索引条件下推优化
http://blog.163.com/li_hx/blog/static/1839914132015782821512/ 一 什么是“索引条件下推” “索引条件下推”,称为 Index Condit ...
- 8.2.1.5 Engine Condition Pushdown Optimization 引擎条件下推优化
8.2.1.5 Engine Condition Pushdown Optimization 引擎条件下推优化 这种优化改善了直接比较在一个非索引列和一个常量比较的效率. 在这种情况下, 条件是 下推 ...
- 深入浅出Hive企业级架构优化、Hive Sql优化、压缩和分布式缓存(企业Hadoop应用核心产品)
一.本课程是怎么样的一门课程(全面介绍) 1.1.课程的背景 作为企业Hadoop应用的核心产品,Hive承载着FaceBook.淘宝等大佬 95%以上的离线统计,很多企业里的离线统 ...
- Mysql系列(十二)—— 索引下推优化
索引条件下推(ICP)是对MySQL使用索引从表中检索行的情况的优化.如果没有ICP,存储引擎会遍历索引以查找基表中的行,并将它们返回给MySQL服务器,该服务器会评估WHERE行的条件.启用ICP后 ...
- hive踩过的小坑
上周使用hive做一些操作,几个小问题纠结很久.特此记录下: hive概念 hive是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并提供简单的sql查询功能,可以 ...
- HDP Hive性能调优
(官方文档翻译整理及总结) 一.优化数据仓库 ① Hive LLAP 是一项接近实时结果查询的技术,可用于BI工具以及网络看板的应用,能够将数据仓库的查询时间缩短到15秒之内,这样的查询称之为Int ...
- Hive常用性能优化方法实践全面总结
Apache Hive作为处理大数据量的大数据领域数据建设核心工具,数据量往往不是影响Hive执行效率的核心因素,数据倾斜.job数分配的不合理.磁盘或网络I/O过高.MapReduce配置的不合理等 ...
- 记录初学者学习Hive时踩过的坑
1. 缺少MySQL驱动包 1.1 问题描述 Caused by: org.datanucleus.store.rdbms.connectionpool.DatastoreDriverNotFound ...
- Hive语句执行优化-简化UDF执行过程
Hive会将执行的SQL语句翻译成对应MapReduce任务,当SQL语句比较简单时,性能还是可能处于可接受的范围.但是如果涉及到非常复杂的业务逻辑,特别是通过程序的方式(一些模版语言生成)生成大 ...
随机推荐
- 419 JQuery and BootStrap
把葵花宝典剩下的知识讲完了 又学习了bootstrap <link rel="stylesheet" href="css/bootstrap.css"&g ...
- CocoaLumberjack——带颜色的Log
CocoaLumberjack可以带颜色Log,具体的好处嘛,谁用谁知道,:] 具体步骤如下: 1. 安装XcodeColors插件 下载地址:https://github.com/robbiehan ...
- 023_System Integrity Protection in macos
背景:之前写的在/usr/bin下的一个登陆线上脚本,由于使用timemachine还原了系统,发现怎么也修改不了,加sudo也不行. 后来查询才得知系统默认开启了"系统集成保护" ...
- Java入门细则
(一)一个完整的Java.源程序应该包括下列部分: package语句,该部分至多只有一句,必须放在源程序的第一句. import语句,该部分可以有若干import语句或者没有,必须放在所有的类定 ...
- tomcat启动后产生的日志
产生的日志 相当于 定时选取webapps里面搜索有没有超时的session,然后将超时的session关掉. 每一个webapp 都是独立的 一个application对应一个context,se ...
- vertx的HttpServer模块
Start HttpServer /** * 启动 HttpServer * multi instances 采用 synchronized防止线程安全问题 * addHandlers 方法是acto ...
- vertx模块HAManager高可用
HAManager public HAManager(VertxInternal vertx, DeploymentManager deploymentManager, ClusterManager ...
- C++—模板(2)类模板与其特化
我们以顺序表为例来说明,普通顺序表的定义如下: typedef int DataType; //typedef char DataType; class SeqList { private : Dat ...
- C语言作业2
一.实验目的与要求 1.if语句的应用 ●掌握C语言的逻辑运算和关系运算的规则 ●学会正确的使用关系表达式和逻辑表达式 ●掌握if-else语句的使用方法 2.switch/case语句的应用 ● ...
- JpaManytoMany
package com.allqj.calculator.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; i ...