简体   繁体   中英

Hive table created successfully but data from S3 bucket is not imported

Created a table and want to move the data from a S3 bucket. Table is created, but data is not imported from S3. What could be the problem? Please help me out, thanks in advance.

hive> CREATE TABLE contraceptive_usage_data( wife_age int, wife_edu int, husb_edu int,no_of_children_born int, wife_religion int,
    > wife_now_working int, husb_occu int, stand_living int, media_exposure int, contraceptive_method_used int) ROW FORMAT 
    > DELIMITED FIELDS TERMINATED BY ',' location 's3://emr.learnings/contraceptive_data/contraceptive_usage_data_indonesia_1988';
OK
Time taken: 16.452 seconds
hive> select * from contraceptive_usage_data limit 10;
OK
Time taken: 1.966 seconds
hive> 

Try using the keyword EXTERNAL,

CREATE EXTERNAL TABLE contraceptive_usage_data( wife_age int, wife_edu int, husb_edu int,no_of_children_born int, wife_religion int,
wife_now_working int, husb_occu int, stand_living int, media_exposure int, contraceptive_method_used int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' 
LOCATION 's3://emr.learnings/contraceptive_data/contraceptive_usage_data_indonesia_1988';

I think without the EXTERNAL keyword, Hive will try to create a new empty table at the location instead of loading the existing data there.

我认为这是因为每一个之后的空间,在价值观。

"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM