Issue
Is there a way to get hdfs location from external table and assign to unix variable.
Solution
Yes, there is a way.
- Run a command like the below,
export location=hive -e "SHOW CREATE TABLE <dbname.tablname>;"| grep hdfs://
Please use after the equal sign on the above command and
at the end. It is not shown here due to Stackoverflow's rich text format.
You can check the variable like the below,
echo $location 'hdfs://hostname:8020/HDFS/PATH/OF/THE/TABLE'
Hope this helps!
Answered By - Gomz