How can I run an Oozie Hive or Hive2 Action with init scripts?
In the CLI this can be usually done via the -i init.hive argument; however when using this in an Oozie Action via <argument>-i init.hive</argument> the workflow stops with an error.
I linked the init.hive file with the <file>init.hive#init.hive</file> property and it is available in the local appcache directory.
$ ll appcache/application_1480609892100_0274/container_e55_1480609892100_0274_01_000001/ | grep init
> lrwxrwxrwx 1 root root 42 Jan 12 12:24 init.hive -> /hadoop/yarn/local/filecache/519/init.hive
The error (in the local appcache) is the following
Connecting to jdbc:hive2://localhost:10000/
Connected to: Apache Hive (version 1.2.1000.2.4.0.0-169)
Driver: Hive JDBC (version 1.2.1000.2.4.0.0-169)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Running init script init.hive
init.hive (No such file or directory)
The hive2 action looks like this (the complete workflow can be found on Github https://github.com/chaosmail/oozie-bugs/tree/master/simple-hive-init/simple-hive-init-wf)
<action name="test-action">
<hive2 xmlns="uri:oozie:hive2-action:0.1">
<jdbc-url>${jdbcURL}</jdbc-url>
<script>query.hive</script>
<argument>-i init.hive</argument>
<file>init.hive#init.hive</file>
</hive2>
<ok to="end"/>
<error to="fail"/>
</action>
Edit 1: added workflow action
pwdit matches with theappcache/application_1480609892100_0274/container_e55_1480609892100_0274_01_000001directory. It seems that the beeline client might not be started in the same local container directory - otherwise it should find the init.hive file - Christoph Körner<argument>tags, and your logs show a leading space before the script name (the space following-i??) >> consider trying<argument>-i</argument><argument>init.hive</argument>- Samson Scharfrichter