hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Omernik <j...@omernik.com>
Subject Re: Running hive inside a bash script
Date Tue, 02 Dec 2014 21:00:30 GMT
That's not what I've found:

$ hive -e "show tables"
table1
table2

$ echo $?
0

$ hive -e "show partitions notable"
FAILED: SemanticException [Error 10001]: Table not found notable

$ echo $?
17


In a bash script:

hive -e "show partitions notable"
hiveresult=`echo $?`
if [ $hiveresult -ne 0 ]; then
    echo "We have a hive Error!!!!"
    echo "Hive Error Num $hiveresult"
    exit 1

else

   echo "Great, no Hive errror, Moving on"

fi



On Tue, Dec 2, 2014 at 12:16 PM, Daniel Haviv
<daniel.haviv@veracity-group.com> wrote:
> Hi,
> I have a bash script that runs a hive query and I would like it to do
> something if the query succeeds and something else if it fails.
> My testings show that a query failure does not change Hive's exit code,
> what's the right way to achieve this ?
>
> Thanks,
> Daniel

Mime
View raw message