Read CSV file and delete hdfs, hive and hbase tables

I have a CSV file with hdfs directories, hive tables and hbase tables.

  1. first column - hdfs directories
  2. second column - hive tables
  3. third column - hbase tables

I have to check the csv file and look for the first column and delete the hdfs directory from the hdfs path, now search for the second column and delete the hive table, after that look for third column and delete the hbase table.

appreciate your help.

A sample input and a desired output would be helpful....

CSV file name: interface.csv

HDFS - Hive - Hbase <<< CSV Header
/unix/win/filename1 - con_tag_incr - con_tag <<< row 1
/unix/win/filename2 - crm_tag_incr - crm_tag <<< row 2
/unix/win/filename3 - retail_tag_incr - retail_tag_incr <<< row 3

Please let me know, if you need more details and appreciate your help

---------- Post updated 10-11-17 at 06:32 AM ---------- Previous update was 10-10-17 at 09:19 AM ----------

#!/bin/bash
input="/home/username/interface.csv"
while IFS=',' read -r f1 f2 f3
do
echo "$f1 $f2 $f3"
hdfs dfs -rm -R /user/"$f1"/retail.csv
hive -f /home/username/droptable.sql
done < "$input"

Now I have to pass the DB_NAME and TABLE_NAME as parameters into the shell script.

DB_NAME's: CON, RETAIL, CRM

DROP TABLE IF EXISTS ${DB_NAME}.${TABLE_NAME};