Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Hive Script


Hive Script

New Contributor

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?


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.




Don't have an account?
Coming from Hortonworks? Activate your account here