Created 05-01-2019 02:42 AM
Created 05-01-2019 11:49 AM
Did you try getting the path from metadata database. We can get the path of all hive tables with single query. Let me know if you already tried that.
-Shashi
Created 05-03-2019 04:21 AM
Sorry we don't have access for that .Can you please share that it will be useful for my future. Now i written different approach to get all hdfs paths and trying to delete them all in one shot .is there anyway to do that.
hive -e " set hive.cli.print.header=false; use $HIVE_SCHEMA;show tables like '*stg';" 1> $tablelist
tableNum_limit=$(cat $tablelist | wc -l)
echo "number of tables in the file $tableNum_limit "
#sed -i e"s/.*/SHOW CREATE TABLE $HIVE_SCHEMA.&;\" $tablelist
sed -i -e "s/.*/DESCRIBE FORMATTED $HIVE_SCHEMA.&;/" $tablelist
#create the file with all describe formatted output
hive -f $tablelist > $loctbl
#remove all the line except the hdfs path
sed -i -e '/^Location/!d;s/Location:\s\+//' $loctbl
#sed -Eni '{N; /^LOCATION\s+/p ; D}' $loctbl
It will retrieve all the hdfs paths into file for the given database and I am trying to delete them is there any short way to delete all in stead of using hdfs dfs -rm -r -skipTrash $table_location each path .