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语句比较简单时,性能还是可能处于可接受的范围.但是如果涉及到非常复杂的业务逻辑,特别是通过程序的方式(一些模版语言生成)生成大 ...
随机推荐
- ruban后台项目启动。进入断点
eclipse debug启动 进入断点显示-------------HikariPool-1 - Starting... 原因是 eclipse和tomcat的交互而产生的,在以debug模式启动t ...
- Python学习笔记-SQLSERVER的大批量导入以及日常操作(比executemany快3倍)
环境 : python3.6 / win10 / vs2017 / sqlserver2017 一.需要安装的包pymssql pip install pymssql 二.pymssql模块的介绍 p ...
- expect 批量自动部署ssh 免密登陆 之 二
#!/usr/bin/expect -f ########################################## hutu #Push the id.pas.pub public key ...
- SecureCRT标签显示IP地址
当使用SecureCRT连接到linux服务器后,SecureCRT的标签会随着操作目录的改变而改变,当连接多个的时候很不好区分,所以需要设置标签栏固定显示IP地址信息. options->Se ...
- 解决springboot启动失败问题:Unable to start embedded container;
将一个springboot项目导入到eclipse后,启动时报错Unable to start embedded container,以下时全部错误信息: Application startup fa ...
- 成环的概率dp(初级) zoj 3329
原题地址:https://vjudge.net/problem/ZOJ-3329 题目大意: 有三个骰子,分别有k1,k2,k3个面,初始分数是0.第i骰子上的分数从1道ki.当掷三个骰子的点数分别为 ...
- 手把手设计MyBatis
最近趁热打铁,研究了一下Mybatis.MyBatis框架的核心功能其实不难,无非就是动态代理和jdbc的操作,难的是写出来可扩展,高内聚,低耦合的规范的代码. 本文完成的Mybatis功能比较简单, ...
- MapReduce流量统计
准备数据access.log 要用到的只有第二个手机号,倒数第三上行流量,倒数第二下行流量. 1363157985066 13726230503 00-FD-07-A4-72-B8:CMCC 120. ...
- shell脚本之不同系统上ftp交互使用
场景:当公司将有文件要自动将ubuntu系统的文件要上传到windows上面,或者windows上的文件要下载到ubuntu上面,尤其是像什么日志啊,编译结果啊,测试结果啊等等,做个备份或者做分析处理 ...
- Zabbix (五)
介绍添加主机时,各个参数的含义 https://blog.51cto.com/5001660/2154692 Zabbix配置介绍: https://blog.51cto.com/5001660/21 ...