New Contributor
Posts: 1
Registered: ‎03-25-2018

Hive Script

Hello Guys,


I have created hive script .hql with multiple individual queries and running fine. But i want to implement error handling within the .hql script. I mean i want the script to be failed when there is an error and should also log an entry in one of our job status table saying FAILED/SUCCESS.


I can write a query at the end of the .hql saying that it is SUCCESS but i need FAILED status as when there is failure in one of the queries.

Can some one please advise?

Posts: 11
Registered: ‎07-10-2014

Re: Hive Script



You don't say which Hive client you're using to run the script with, but most of the command line tools, e.g., beeline support exiting non-zero on the first command failure, or exiting zero if everything ran successfully. Checking the exit status is probably more reliable than relying on the error output of the tool, and a wrapper around the tool can convert the exit status to success or failure status codes and log it.