1

When we Load data into Hive table from HDFS, it deletes the file from source directory(HDFS) is there a way we can keep the file in the source directory and load the data into hive table as well.

I used the below query;

LOAD DATA INPATH 'source_file_path' insert INTO TABLE TABLENAME;
leftjoin
  • 36,950
  • 8
  • 57
  • 116

1 Answers1

0

Hive does not do any transformation while loading data into tables. Load operations are currently pure copy/move operations that move datafiles into locations corresponding to Hive tables.

Use hadoop fs cp or hdfs dfs cp commands to copy (not move) files:

hadoop fs -cp [source_file_path] [table_location_path]

or

hdfs  dfs cp [source_file_path] [table_location_path]

Use decribe formatted tablename command to check table location path.

leftjoin
  • 36,950
  • 8
  • 57
  • 116