【问题标题】:Load Data into Hive on EMR将数据加载到 EMR 上的 Hive
【发布时间】:2019-12-08 10:35:38
【问题描述】:

我在 EMR 服务下创建了一个集群,然后我与 Putty 连接。 同时,我在构建集群时选择了“presto”。

如何将文件从 S3 或本地计算机传输到 hive?

例如,我需要上传学生文件,但是当我运行以下代码时,我自然会出错。学生档案放在哪里?

hive > load data local inpath 'student' into table student_nopart;

我想在这里举个例子。 https://github.com/weltond/LearnBasicBigDataTech

【问题讨论】:

    标签: amazon-s3 hive amazon-emr


    【解决方案1】:

    在您的代码中,

    load data local inpath ...
    

    local 表示 EMR 节点,而不是您的计算机。通过使用 sftp 或其他方式,您应该先将文件上传到 EMR 并加载它。

    或者使用这个。

    load data inpath 's3://bucket/path/to/file/' into table <tablename>
    

    【讨论】:

      【解决方案2】:

      如果您在 S3 中已有数据,则可以在 S3 位置之上构建 Hive 表或更改现有 Hive 表。

      ALTER TABLE student SET location='s3://bucket/path/to/folder_with_table_files';
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-03-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-03-07
        • 1970-01-01
        相关资源
        最近更新 更多