如何手动将 spark-redshift AVRO 文件加载到 Redshift 中?
How to manually load spark-redshift AVRO files into Redshift?
我有一个 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] -----------------------------------------------
这可以吗?能省掉处理就好了
我在 Redshift 中遇到了同样的错误。
我删除了_committedxxx 和_startedxxx 文件(_SUCCESS 文件没有问题)后,COPY 工作。
如果您在 s3 中有很多目录,您可以使用 aws cli 清除这些文件:
aws s3 rm s3://my_bucket/my/dir/ --include "_comm*" --exclude "*.avro" --exclude "*_SUCCESS" --recursive
请注意,cli 似乎有一个错误,--include "_comm*" 对我不起作用。所以它试图删除 all 个文件。使用“--exclude *.avro”就可以了。小心 运行 命令先加上 --dry运行!!
我有一个 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] -----------------------------------------------
这可以吗?能省掉处理就好了
我在 Redshift 中遇到了同样的错误。
我删除了_committedxxx 和_startedxxx 文件(_SUCCESS 文件没有问题)后,COPY 工作。
如果您在 s3 中有很多目录,您可以使用 aws cli 清除这些文件:
aws s3 rm s3://my_bucket/my/dir/ --include "_comm*" --exclude "*.avro" --exclude "*_SUCCESS" --recursive
请注意,cli 似乎有一个错误,--include "_comm*" 对我不起作用。所以它试图删除 all 个文件。使用“--exclude *.avro”就可以了。小心 运行 命令先加上 --dry运行!!