09-16-2015 03:18 AM
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.
09-20-2015 07:37 AM
09-22-2015 01:38 AM - edited 09-22-2015 01:39 AM
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' ?
09-22-2015 06:17 AM
09-22-2015 06:19 AM
09-22-2015 10:17 AM