【问题标题】:How to manually load spark-redshift AVRO files into Redshift?如何手动将 spark-redshift AVRO 文件加载到 Redshift?
【发布时间】:2017-12-30 12:08:12
【问题描述】:

我有一个 Spark 作业在写入的 COPY 部分失败。我已经在 S3 中处理了所有输出,但是在弄清楚如何手动加载它时遇到了麻烦。

COPY table
FROM 's3://bucket/a7da09eb-4220-4ebe-8794-e71bd53b11bd/part-'
CREDENTIALS 'aws_access_key_id=XXX;aws_secret_access_key=XXX'
format as AVRO 'auto'

在我的文件夹中有一个_SUCCESS_committedxxx_startedxxx 文件,然后是99 个文件都以前缀part- 开头。当我运行它时,我得到一个 stl_load_error -> Invalid AVRO file found. Unexpected end of AVRO file. 如果我去掉那个前缀,那么我得到:

[XX000] ERROR: Invalid AVRO file Detail: ----------------------------------------------- error: Invalid AVRO file code: 8001 context: Cannot init avro reader from s3 file Incorrect Avro container file magic number query: 10882709 location: avropath_request.cpp:432 process: query23_27 [pid=10653] -----------------------------------------------

这可能吗?保存处理会很好。

【问题讨论】:

    标签: apache-spark amazon-redshift avro spark-avro


    【解决方案1】:

    我在 Redshift 中遇到了同样的错误。

    删除 _committedxxx 和 _startedxxx 文件后 COPY 有效(_SUCCESS 文件没有问题)。

    如果您在 s3 中有很多目录,您可以使用 aws cli 清除这些文件:

    aws s3 rm s3://my_bucket/my/dir/ --include "_comm*" --exclude "*.avro" --exclude "*_SUCCESS" --recursive
    

    请注意,cli 似乎有一个错误,--include "_comm*" 对我不起作用。所以它试图删除所有个文件。使用“--exclude *.avro”就可以了。小心,先用--dryrun运行命令!!

    【讨论】:

      猜你喜欢
      • 2019-02-11
      • 1970-01-01
      • 2016-09-19
      • 2023-03-27
      • 2020-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多