Hive QL模块执行计划优化分析

发布时间:2022-06-28 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Hive QL模块执行计划优化分析脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

Transform

查询优化的基类,优化过程通过子类重写transform(ParseContext pctx)函数实现。

/**
 * Optimizer interface. All the rule-based optimizations implement this
 * interface. All the transformations are invoked sequentially. They take the
 * current parse context (which contains the operator tree among other things),
 * PErform all the optimizations, and then return the updated parse context.
 */
public abstract class Transform {
  /**
   * All transformation steps implement this interface.
   * 
   * @param pctx
   *          input parse context
   * @return ParseContext
   * @throws SEManticException
   */
  public abstract ParseContext transform(ParseContext pctx) throws SemanticException;
  
  public void beginPerfLOGging() {
    PerfLogger perfLogger = Sessionstate.getPerfLogger();
    perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.OPTIMIZER);
  }

  public void endPerfLogging() {
    PerfLogger perfLogger = SessionState.getPerfLogger();
    perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER);
  }
  public void endPerfLogging(String addITionalInfo) {
    PerfLogger perfLogger = SessionState.getPerfLogger();
	perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER, additionalInfo);
  }  
}

SimpleFetchOptimizer

通过对执行计划的判断,根据数据量以及是否需要group by等操作判断是否可以直接返回hDFs中的数据,避免执行mapreduce过程。

/**
 * Tries to convert simple fetch query to single fetch task, which fetches rows directly
 * From location of table/partition.
 */

脚本宝典总结

以上是脚本宝典为你收集整理的Hive QL模块执行计划优化分析全部内容,希望文章能够帮你解决Hive QL模块执行计划优化分析所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。