I am in need to hook a custom execution hook in Apache Hive. Please let me know if somebody know how to do it.
The current environment I am using is given below:
Hadoop : Cloudera version 4.1.2 Operating system : Centos
Thanks, Arun
I am in need to hook a custom execution hook in Apache Hive. Please let me know if somebody know how to do it.
The current environment I am using is given below:
Hadoop : Cloudera version 4.1.2 Operating system : Centos
Thanks, Arun
a good start --> http://dharmeshkakadia.github.io/hive-hook/
there are examples...
note: hive cli from console show the messages if you execute from hue, add a logger and you can see the results in hiveserver2 log role.
There are several types of hooks depending on at which stage you want to inject your custom code:
If you run a script the processing flow looks like as follows:
HiveDriverRunHook.preDriverRun()
(
HiveConf.ConfVars.HIVE_DRIVER_RUN_HOOKS
)AbstractSemanticAnalyzerHook.preAnalyze()
(
HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK
)AbstractSemanticAnalyzerHook.postAnalyze()
(
HiveConf.ConfVars.SEMANTIC_ANALYZER_HOOK
)ExecuteWithHookContext.run()
(
HiveConf.ConfVars.PREEXECHOOKS
)ClientStatsPublisher.run()
is called to publish statistics(
HiveConf.ConfVars.CLIENTSTATSPUBLISHERS
)If a task fails:
ExecuteWithHookContext.run()
(
HiveConf.ConfVars.ONFAILUREHOOKS
)ExecuteWithHookContext.run()
(
HiveConf.ConfVars.POSTEXECHOOKS
)HiveDriverRunHook.postDriverRun()
(
HiveConf.ConfVars.HIVE_DRIVER_RUN_HOOKS
)For each of the hooks I indicated the interfaces you have to implement. In the brackets there's the corresponding conf. prop. key you have to set in order to register the class at the beginning of the script. E.g: setting the PreExecution hook (9th stage of the workflow)
Unfortunately these features aren't really documented, but you can always look into the Driver class to see the evaluation order of the hooks.
Remark: I assumed here Hive 0.11.0, I don't think that the Cloudera distribution differs (too much)