Hook简介

Hive在程序启动不同阶段设置了hook供用户自定义不同的行为

一共有四个阶段提供Hook以供注入定制化代码

  • Driver run hooks (Pre/Post)
  • Semantic analyizer hooks (Pre/Post)
  • Execution hooks (Pre/Failure/Post)
  • Client statistics publisher
Hive的运行流程为:

  1. Driver.run() takes the command
  2. HiveDriverRunHook.preDriverRun()
    (HiveConf.ConfVars.HIVE_DRIVER_RUN_HOOKS)
  3. Driver.compile() starts processing the command: creates the abstract syntax tree
  4. AbstractSemanticAnalyzerHook.preAnalyze() 
    (HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK)
  5. Semantic analysis
  6. AbstractSemanticAnalyzerHook.postAnalyze() 
    (HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK)
  7. Create and validate the query plan (physical plan)
  8. Driver.execute() : ready to run the jobs
  9. ExecuteWithHookContext.run() 
    (HiveConf.ConfVars.PREEXECHOOKS)
  10. ExecDriver.execute() runs all the jobs
  11. For each job at every HiveConf.ConfVars.HIVECOUNTERSPULLINTERVAL interval:
    ClientStatsPublisher.run() is called to publish statistics
    (HiveConf.ConfVars.CLIENTSTATSPUBLISHERS)
    If a task fails: ExecuteWithHookContext.run() 
    (HiveConf.ConfVars.ONFAILUREHOOKS)
  12. Finish all the tasks
  13. ExecuteWithHookContext.run() 
    (HiveConf.ConfVars.POSTEXECHOOKS)
  14. Before returning the result HiveDriverRunHook.postDriverRun() 
    HiveConf.ConfVars.HIVE_DRIVER_RUN_HOOKS)
  15. Return the result.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值