You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Raihan Jamal <ja...@gmail.com> on 2012/08/16 02:03:14 UTC
Exit Status for Success and Failure in HiveQL queries
Does the hive command make use of an exit status for success vs. failure?
I am asking this question as I am executing my few HiveQL queries from my
Shell Script and If one HiveQL queries gets failed due to certain reasons,
I want to abort my shell script at that moment only without executing other
HiveQL queries.
*Raihan Jamal*
Re: Exit Status for Success and Failure in HiveQL queries
Posted by Raihan Jamal <ja...@gmail.com>.
Let me try that.. Thanks for the help.
*Raihan Jamal*
On Wed, Aug 15, 2012 at 5:10 PM, hadoop hive <ha...@outlook.com> wrote:
> Hey Jamal,
> You can use bash shell script combined with hive query, in shell script
> you can check for exit status.
> E.g :
> #!/bin/bash
> hive -e "show tables;"
> RET_VAL=$?
> if [ $RET_VAL -ne 0]; then
> exit(1)
>
> -
>
>
>
> ------------------------------
> From: jamalraihan@gmail.com
> Date: Wed, 15 Aug 2012 17:03:14 -0700
> Subject: Exit Status for Success and Failure in HiveQL queries
> To: user@hive.apache.org
>
>
> Does the hive command make use of an exit status for success vs. failure?
>
> I am asking this question as I am executing my few HiveQL queries from my
> Shell Script and If one HiveQL queries gets failed due to certain reasons,
> I want to abort my shell script at that moment only without executing other
> HiveQL queries.
>
>
>
>
> *Raihan Jamal*
>
>
RE: Exit Status for Success and Failure in HiveQL queries
Posted by hadoop hive <ha...@outlook.com>.
Hey Jamal, You can use bash shell script combined with hive query, in shell script you can check for exit status. E.g :#!/bin/bashhive -e "show tables;"RET_VAL=$?if [ $RET_VAL -ne 0]; then exit(1)
-
From: jamalraihan@gmail.com
Date: Wed, 15 Aug 2012 17:03:14 -0700
Subject: Exit Status for Success and Failure in HiveQL queries
To: user@hive.apache.org
Does the hive command make use of an exit status for success vs. failure?
I am asking this question as I am executing my few HiveQL queries from my Shell Script and If one HiveQL queries gets failed due to certain reasons, I want to abort my shell script at that moment only without executing other HiveQL queries.
Raihan Jamal
Re: Exit Status for Success and Failure in HiveQL queries
Posted by abhiTowson cal <ab...@gmail.com>.
hi Raihan,
I was in the same situation before.See if this thing helps you.
Hive command writes to a log file and you cat that file for the success pattern.
Let me know if this will help you.Need any further help??
for log in $logdir1/*.hivelog;
do
cat $log | grep "success pattern" #&> /dev/null
if [ $? -eq 0 ]
then
echo $log job suceeded
else
echo $log job failed
fi
done
{ while read myline;do
filePath=$LOCAL_ROOT_DIR$PREFIXS"/"$myline
HIVELOGNAME=`echo $myline | cut -d . -f 1`
( hive -f $fileName.tmp > $LOGDIR/$HIVELOGNAME.hivelog 2>&1 ) &
done } < $LOCAL_ROOT_DIR$PREFIXS"/"$FILE_LIST
}
Regards
Abhishek
On Wed, Aug 15, 2012 at 8:03 PM, Raihan Jamal <ja...@gmail.com> wrote:
> Does the hive command make use of an exit status for success vs. failure?
>
> I am asking this question as I am executing my few HiveQL queries from my
> Shell Script and If one HiveQL queries gets failed due to certain reasons, I
> want to abort my shell script at that moment only without executing other
> HiveQL queries.
>
>
>
>
> Raihan Jamal
>