In my db i have many tables that start with 'bza' in table name.
I wrote all those table names into a text file name as tables.txt
Now using a shell script (count_row.sh) I am reading each line from tables.txt and execuing the hive commnad:
while IFS='' read -r line || [[ -n "$line" ]]; do echo "" echo "" echo "" echo "Counting the table : $line" eval "hive -e 'select count(*) from $line'" done < "$1"
This results in total rows from each table, which I am writting it into a text file rows.txt as
$ ./count_row.sh tables.txt > row.txt
Now my task is I want to count the total number of rows from all the tables by summing the individual result.
Is there any way to achieve that ? Or any alternate way to count the rows from mutliple tables.
By saying "Generate a list of queries" you mean, creating a list of queries and separate by ;(semicolon) in hive command like
hive -e 'query1;query2;...queryN' ?
It doesn't work for me, here is the screenshot:
What am I missing here?
Thank you very much.