hadoop - Hive 表已成功创建,但未导入 S3 存储桶中的数据

标签 hadoop amazon-s3 hive

创建了一个表并希望从 S3 存储桶中移动数据。 已创建表,但未从 S3 导入数据。 可能是什么问题呢?请帮助我,在此先感谢。

以下是一系列命令和相应的输出:

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> 

S3 存储桶中的样本数据

39, State-gov, 77516, Bachelors, 13, Never-married, Adm-clerical, Not-in-family, White, Male, 2174, 0, 40, United-States, <=50K
50, Self-emp-not-inc, 83311, Bachelors, 13, Married-civ-spouse, Exec-managerial, Husband, White, Male, 0, 0, 13, United-States, <=50K
38, Private, 215646, HS-grad, 9, Divorced, Handlers-cleaners, Not-in-family, White, Male, 0, 0, 40, United-States, <=50K
53, Private, 234721, 11th, 7, Married-civ-spouse, Handlers-cleaners, Husband, Black, Male, 0, 0, 40, United-States, <=50K
28, Private, 338409, Bachelors, 13, Married-civ-spouse, Prof-specialty, Wife, Black, Female, 0, 0, 40, Cuba, <=50K
37, Private, 284582, Masters, 14, Married-civ-spouse, Exec-managerial, Wife, White, Female, 0, 0, 40, United-States, <=50K
49, Private, 160187, 9th, 5, Married-spouse-absent, Other-service, Not-in-family, Black, Female, 0, 0, 16, Jamaica, <=50K
52, Self-emp-not-inc, 209642, HS-grad, 9, Married-civ-spouse, Exec-managerial, Husband, White, Male, 0, 0, 45, United-States, >50K

最佳答案

尝试使用关键字 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';

我认为如果没有 EXTERNAL 关键字,Hive 将尝试在该位置创建一个新的空表,而不是在那里加载现有数据。

关于hadoop - Hive 表已成功创建,但未导入 S3 存储桶中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20866875/

相关文章:

php - 将 Amazon S3 与 FineUploader 结合使用时出错

hadoop - 为什么部分文件在 HIVE 输出中没有任何内容

authentication - 具有PasswordAuthenticator和模式自动创建功能的DataStax Enterprise Hive

java - 我可以通过 hadoop 中的代码明确地提前完成 map task 吗?

hadoop - 在单个mapreduce程序中加入三个文件

hadoop - 无法在多节点hadoop集群设置中运行datanode,需要建议

Hadoop - Hawq - 添加新段

redirect - S3 将基域重定向到 key 前缀文件夹

amazon-s3 - Laravel 将文件从一个磁盘移动到另一个磁盘 - 使用 `Storage`

hadoop - 通过 oozie 运行的配置单元查询的 CPU 时间