You will need to do
select count(*) from table
for all tables.
To automate this, you can make small bash script commands and some bash. First start
$hive -e 'show tables' | tee tables.txt
All tables in the database are stored here in the text file tables.txt
Create a bash file (count_tables.sh) with the following contents.
while read line
do
echo "$line "
eval "hive -e 'select count(*) from $line'"
done
Now run the following commands.
$chmod +x count_tables.sh
$./count_tables.sh < tables.txt > counts.txt
This creates a text file (counts.txt) with a count of all the tables in the database
source
share