Created on 09-16-2015 03:18 AM - edited 09-16-2022 02:41 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.
Created on 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' ?
Created 09-22-2015 02:26 AM
Created 09-22-2015 06:17 AM
Created 09-22-2015 06:19 AM
Created 09-22-2015 10:05 AM
Created 09-22-2015 10:17 AM
Created 05-05-2017 06:22 PM
It doesn't work for me, here is the screenshot:
What am I missing here?
Thank you very much.
Created 07-31-2019 04:26 AM
Done keyword is missing in your script. In your loop body use done at last.