Richard Rymer
Richard Rymer

Reputation: 153

hive query that will fail if table is empty

I have a series of workflows in oozie that will periodically fail silently by simply not filling the target table. The failures are a result of, among other things, a change input like a non-ascii character or a double escape sneaking into the data, that kind of thing. However, the job actually finishes successfully. I would like the jobs to fail if the table does not fill. Is there any easy way to do this directly in Oozie, or with a simple Hive query that will fail on an empty table?

Upvotes: 1

Views: 525

Answers (1)

K S Nidhin
K S Nidhin

Reputation: 2650

Oozie doesn't fail the action as oozie sees that the hive query has been successfully executed , it doesn't care about anything else

A workaround for your case :

  1. hive action that loads the table
  2. another hive action that checks the count of the table , capture output.
  3. use decision node such that if above captured output value is 0 then kill the workflow.

hope this workaround helps .

Upvotes: 2

Related Questions