【问题标题】:how to load directory data into hive如何将目录数据加载到配置单元中
【发布时间】:2016-05-13 07:08:26
【问题描述】:

如何将 hdfs 文件加载到 hive 中。在我的项目中,它需要将 hdfs 文件加载到 hive 中。我的 hdfs 文件结构类似于 `/flume/topic/date/hour/file.hdfs`,问题是如何自动加载目录数据。

【问题讨论】:

  • 是的,我使用分区表来解决这个应用程序。
  • 你有遇到同样的问题吗?

标签: file hive load hdfs


【解决方案1】:
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;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-12
    • 1970-01-01
    • 2016-10-11
    相关资源
    最近更新 更多