Hi,
I wanted to load data from HDFS to HIVE by writing bash script.
Description:
I have written a bash script to validate the data and loaded validated data from local file system to HDFS. Now in the same bash script i wanted to load the data from HDFS to HIVE. How can i do it ? Also how tyhe hive shell is called when i excecute the bash script (.sh file)?
Below is the code i have written to load the data form local to hdfs.
#!/bin/bash
<code to validate the file on local>
hadoop fs -put /home/hduser/validate/badrec /user/hduser/Dataparse/
hadoop fs -put /home/hduser/validate/goodrec /user/hduser/Dataparse/
No i wanted to add the below hive create table statement and load statement in the same bash script file
create table GoodRecords(
id int,
name string,
state string,
phone_no int,
gender string) row format delimited fields terminated by ',' stored as textfile;
LOAD DATA INPATH '/user/hduser/Dataparse/goodrec' INTO TABLE GoodRecords;
Please suggest me how this can be done ?
Thanks,
Shree