【发布时间】:2016-05-13 07:08:26
【问题描述】:
如何将 hdfs 文件加载到 hive 中。在我的项目中,它需要将 hdfs 文件加载到 hive 中。我的 hdfs 文件结构类似于 `/flume/topic/date/hour/file.hdfs`,问题是如何自动加载目录数据。
【问题讨论】:
-
是的,我使用分区表来解决这个应用程序。
-
你有遇到同样的问题吗?
如何将 hdfs 文件加载到 hive 中。在我的项目中,它需要将 hdfs 文件加载到 hive 中。我的 hdfs 文件结构类似于 `/flume/topic/date/hour/file.hdfs`,问题是如何自动加载目录数据。
【问题讨论】:
1) Directory contains three files
-rw-r--r-- 1 hadoop supergroup 125 2017-05-15 17:53/hallfolder/hall.csv
-rw-r--r-- 1 hadoop supergroup 125 2017-05-15 17:53/hallfolder/hall1.csv
-rw-r--r-- 1 hadoop supergroup 125 2017-05-15 17:54/hallfolder/hall2.csv
2) Enable this command
hive > SET mapred.input.dir.recursive=true;
3) hive>
hive>load data inpath '/hallfolder/*' into table alltable;
【讨论】: