Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Please see the Cloudera blog for information on the Cloudera Response to CVE-2021-4428

OOzie - Hive Script issue

	<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.5" name="Sub_WF_RESERVE_FEATURE_Insert_claiminfo">
<start to="Clean_output_folder" />
<!-- Delete Output Folder from HDFS -->
<action name="Clean_output_folder">
<hive xmlns="uri:oozie:hive-action:0.2">
<job-tracker>p01bdl822.aap.csaa.com:8050</job-tracker>
<name-node>hdfs://csaa-aap-sb</name-node>
<job-xml>hdfs://csaa-aap-sb/user/xgn74cha/reserve/hive-site.xml</job-xml> <configuration> <property> <name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property> <!--<property> <name>tez.lib.uris</name> <value>${tez_lib_path}</value> </property> -->
<property> <name>oozie.launcher.mapred.job.queue.name</name> <value>${queueName}</value>
</property> </configuration>
<script>hdfs://csaa-aap-sb/user/xgn74cha/reserve/script/InsertMaxRunDate.hql</script>
</hive>
<ok to="end" />
<error to="fail" />
</action>
<kill name="fail"> <message>Failed WorkFlow Name : SUB_WF_RESERVE_FEATURE_PREDICTIVE_MODEL_Insert_claiminfo </message> </kill>
<end name="end" /> </workflow-app>

I have below Oozie script. It completes when I run using oozie command, but script <script>hdfs://csaa-aap-sb/user/xgn74cha/reserve/script/InsertMaxRunDate.hql</script> does not return any result. While the same script returns result when I run Hue UI/ Beeline CLI. I have one observation that script does not return anything if I use Hive CLI. Kindly let me know, how to make the script to be run as beeline??

The script is

use reservemodel; SET hive.execution.engine = tez; set mapreduce.job.queuename=PA_clm;

SET hive.vectorized.execution.enabled=false; SET hive.auto.convert.join=false;

INSERT OVERWRITE DIRECTORY 'hdfs://csaa-aap-sb/user/xgn74cha/reserve/output1/'

select case when max(run_date) is null then to_date('1970-12-31') else to_date(max(run_date)) end as max_run_date from reservemodel.orc_policyinfo;

4 REPLIES 4

Mentor
@Mamta Chawla

please look at my workflow https://github.com/dbist/oozie/tree/master/apps/hcatalog

replace my pig script with your hive script and try it out. Replace my hive-site.xml with yours.

Hi,

My issue is, it does not run on hive CLI, the script only runs on Beeline CLI. what changes to do in Oozie WF, so that HQL get executed on Beeline CLI??

I do not understand why the script doesn't run in hive but if you want beeline you need to use a hive2 action

https://community.hortonworks.com/articles/3251/running-hive-in-oozie-with-hive2action-and-passwor.h...

Expert Contributor

hive action doesn't allow to return output to oozie workflow.

The only way to capture output is to use Java or Shell actions:

https://oozie.apache.org/docs/3.2.0-incubating/WorkflowFunctionalSpec.html#a3.2.7_Java_Action

Read about capture-output flag.