bsam
bsam

Reputation: 1928

Table not found exception when running hive query via an Oozie shell script

I m trying to run a hive count query on a table from a bash action in the Oozie workflow but I always get a table not found exception.

#!/bin/bash
COUNT=$(hive -S -e "SELECT COUNT(*) FROM <table_name> where <condition>;")
echo $COUNT

The idea is to get the count stored in a variable for further analysis. This works absolutely fine if run it directly from a local file on the shell. I can do this by splitting it into 2 separate actions, where I first output hive query result to a temp directory and then read the file in the bash script.

Any help appreciated. Thanks!

Upvotes: 0

Views: 343

Answers (1)

bsam
bsam

Reputation: 1928

Fixed it. I had some user permissions issue in accessing the table and also had to add the following property config to do the trick:

SET mapreduce.job.credentials.binary = ${HADOOP_TOKEN_FILE_LOCATION}

Upvotes: 0

Related Questions