关键词: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做下推优化的同学需要留意一下这个问题。

转载于:https://www.cnblogs.com/lhfcws/p/7762005.html

HDP Hive StorageHandler 下推优化的坑相关推荐

  1. mysql索引下沉_MySQL 5.6 索引条件下推优化

    索引下推优化是MySQL5.6版本中新加的功能. 索引条件下推(ICP)是对MySQL使用索引从表中检索行的情况的优化.如果没有ICP,存储引擎会遍历索引以查找基表中的行,并将它们返回给MySQL服务 ...

  2. MySql 一条普通的查询语句 你知道如何优雅的使用 前缀索引、索引下推优化查询速度吗?

    在码农的世界里,优美的应用体验,来源于程序员对细节的处理以及自我要求的境界,年轻人也是忙忙碌碌的码农中一员,每天.每周,都会留下一些脚印,就是这些创作的内容,有一种执着,就是不知为什么,如果你迷茫,不 ...

  3. linux多线程入库hive,hiveserver2 定时挂采坑记

    0 问题描述 集群的 3 台 hiveserver 非常有规律 (每隔 4-5 天)相继下线,无法提供服务,日志里面大量报错,报错里面的一个关键信息如下: logs/hiveserver2.log.2 ...

  4. [一起学Hive]之十二-Hive SQL的优化

    十一.Hive SQL的优化 本章只是从HQL层面介绍一下,日常开发HQL中需要注意的一些优化点,不涉及Hadoop层面的参数.配置等优化. 其中大部分是我之前发过的博客文章,这里整理了下. 11.1 ...

  5. Hive On Spark优化

    1.Hive官方建议的Hive On Spark优化 mapreduce.input.fileinputformat.split.maxsize=750000000hive.vectorized.ex ...

  6. 《MySQL实战45讲》——学习笔记04-05 “深入浅出索引、最左前缀原则、索引下推优化“

    04 | 深入浅出索引(上) 1. 什么是索引? 索引的出现其实就是为了提高数据查询的效率,就像书的目录一样,书有500页,每页存的都是书的内容,目录可能只有5页,只存了页码:通过目录能快速找到某个主 ...

  7. 浅谈Hive SQL的优化

    目前团队的数据处理都在Hadoop集群上, 一是因为需要处理的数据量都是亿级的,这种规模的数据适合用Hadoop集群并行处理: 二是免除了分库分表给查询处理上带来的麻烦.Hive是基于Hadoop的一 ...

  8. [Hive]Hive常用的优化方法

    目录 Hive调优原则 规划阶段优化 Hive表文件的格式 Hive文件及中间文件的压缩方式 根据业务实际需要创建分区表 根据业务实际创建分桶表 数据处理阶段优化 裁剪列 JOIN避免笛卡尔积 启动谓 ...

  9. hive的set优化_Hive优化(整理版)

    1. 概述 1.1 hive的特征: 可以通过SQL轻松访问数据的工具,从而实现数据仓库任务,如提取/转换/加载(ETL),报告和数据分析: 它可以使已经存储的数据结构化: 可以直接访问存储在Apac ...

最新文章

  1. 17.跟金根回顾敏捷个人:技术研究之道
  2. php和python区别-PHP与Python语言有哪些区别之处?选择哪一个好?
  3. AndroidStudio直接通过gradle无mk编译生成so
  4. SQLAlchemy 使用经验
  5. mysql服务器性能剖析,高性能MySQL–服务器性能剖析
  6. 程序员一定要知道的11个实用工具网站
  7. 乌邦图怎么装php,Ubuntu如何安装php7?
  8. 动态规划之插头DP入门
  9. 幻想西游php源码,如何搭建幻想西游服务器
  10. java学生成绩管理系统源码
  11. 【虚拟机里测试Windows PE的方法】
  12. uniapp 实现拨打电话
  13. 《第一堂棒球课》:王牌捕手·棒球2号位
  14. Linux服务器使用Less查看日志文件
  15. 股票涨跌预测方法之二:股票技术指标计算
  16. 论文阅读 Skeleton-based abnormal gait recognition with spatio-temporal attention enhanced
  17. excel如何筛选一列数据的重复值,并找到其他列的对应数据
  18. 医学图像处理技术_上海交大---第一章笔记
  19. 爬虫01-requests的基本用法
  20. LES on MCT

热门文章

  1. elf section类型_ELF文件格式解析
  2. PowerDesigner在生成SQL时报错Generation aborted due to errors detected during the verification of the mod
  3. JSON字符串与Map互转
  4. layui-table 多一列问题
  5. android java service_[Java教程]Android四大组件之Service浅见
  6. 我的世界服务器显示unknown,我的世界找不到家怎么办-​我的世界unknown
  7. java模拟多个用户操作,JAVA 模拟多用户提交动作
  8. Python入门--数据类型的转换
  9. 绑定多个下拉框数据(关系式)
  10. 快速幂算法c语言求a的n次方,快速幂运算模板(求n^k以及前几位或后几位)