Support Questions

Find answers, ask questions, and share your expertise

Hive load data inpath issue - HDP 2.5.3

Explorer

Hive load data inpath is removing source folder after loading data into hive table.

Example :

1 - hadoop fs -put test_file.csv /user/demo/path/

2 - hive> load data inpath '/user/demo/path/' overwrite into table default.test_daily_load_table;

Loading data to table default.test_daily_load_table.

- This command has removed /path folder from HDFS after loading the data into Hive table .

3 - hadoop fs -put test_file_2.csv /user/demo/path/

put: `/user/demo/path/': No such file or directory: `/user/demo/path'

1 REPLY 1

Expert Contributor

@Nelson KA Rajendran

Define the table using 'external' keyword which leaves the files in place, but creates the table definition in the hive metastore.

create external table test_daily_load_table ( id int, myfields string )
row format delimited fields terminated by ','
location '/user/demo/path/';

Also refer https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable

for create table ddl.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.