Yogesh Varal
Yogesh Varal

Reputation: 131

how to use hive query output in decision making of the oozie workflow

I have use case like below. There is table in hive which has flag value either 1 or 0.Read this hive table using hive action in oozie workflow and retrieve this flag value.If this flag is 1 then call sqoop action else if flag value is 0 then terminate this workflow and exit. How to get the output of hive query out of hive action and use it for the oozie workflow decision making.

Upvotes: 1

Views: 1763

Answers (1)

Jyadav
Jyadav

Reputation: 101

There are two ways you can do that.

  1. Create a java action and directly connect to hive through jdbc and perform the column value lookup.

  2. Create Oozie shell action and put select your select query like "hive -e " inside it, along with that you need to use capture_output option under your workflow and also need to specify the system property OOZIE_JAVA_MAIN_CAPTURE_OUTPUT_FILE="output file location" so that it can capture and store output in the file. Now you can access this file content by creating oozie EL-function across your oozie context.

Refer this link for EL-funtion example : https://blog.cloudera.com/blog/2013/09/how-to-write-an-el-function-in-apache-oozie/

Upvotes: 1

Related Questions