Reputation: 1
I am Trying to load data into hive from HDFS . But I Observed that data is moving , meaning after loading the data into hive environment if i look at the HDFS the data which i have loaded is not present . can You Please answer this question with example .
Upvotes: 0
Views: 1750
Reputation: 3783
If you would like to create a table in Hive from data in HDFS without moving the data into /user/hive/warehouse/
, you should use the optional EXTERNAL
and LOCATION
keywords. For example, from this page, we have the following example CREATE TABLE
statement:
hive> CREATE EXTERNAL TABLE userline(line STRING) ROW FORMAT
DELIMITED FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
STORED AS TEXTFILE
LOCATION '/home/admin/userdata';
Without those, Hive will take your data from HDFS and load it into /user/hive/warehouse
(and if the table is dropped, the data is also deleted).
Upvotes: 2