pig通过hcatstorer()写入s3“成功”,写入0字节

eeq64g8w  于 2021-06-21  发布在  Pig
关注(0)|答案(1)|浏览(332)

我创建了一个存储在s3中的外部配置单元(emr上的1.0)表。我可以成功地使用hive将记录插入到这个表中,查询它们,并直接从s3 bucket中提取文件作为验证。到目前为止,还不错。
我希望能够使用pig(v0.14,也在emr上)读写这个逻辑表。用hcatloader()加载工作正常,dump/explain确认我的数据和模式与预期一致。
但是,当我尝试使用hcatstorer()编写时,我遇到了问题。pig报告成功,有n条记录,但写入了0字节。我在日志中看不到任何相关或指示问题的内容,也没有数据写入表/存储桶。

a = load 'myfile' as (foo: int, bar: chararray); // Just assume that this works. 
dump a; // Records are there
describe a; // Correct schema, as specified above
store a into 'mytable' using org.apache.hive.hcatalog.pig.HCatStorer();

输出(同样不包含我能看到的问题的其他指示)的结论是:

Success!

...

Input(s):
Successfully read 2 records (24235 bytes) from: "myfile"

Output(s):
Successfully stored 2 records in: "mytable"

Counters:
Total records written : 2
Total bytes written : 0
Spillable Memory Manager spill count : 0
Total bags proactively spilled: 0
Total records proactively spilled: 0

值得注意的是:
如果表位置在hdfs中而不是s3中(对于外部表和内部表,并且来自hive或pig),那么这在相同的环境中也可以工作。
我可以成功地直接存储到s3与例如。 store a into 's3n://mybucket/output' using PigStorage(','); 通过配置单元外壳向同一查询插入可以正常工作。
因此,这似乎是pig/hcatalog/s3作为堆栈相互作用的问题;任何两个放在一起都可以。
考虑到我在pig日志中没有看到任何有用的东西,我还应该看什么来调试这个呢?对于这些技术中的任何一种,我都应该查看哪些特定的配置参数?

kx7yvsdv

kx7yvsdv1#

我认为当您使用hcatalog从pig向s3写入数据时有一个问题。因为最终的输出数据正在写入一个临时文件,并且永远不会被复制/移动到原始位置。这种奇怪的行为只有在s3上才会遇到。
在我的例子中,输出应该写入s3://x/y/,但是数据被写入s3://x/y/\u temporary/attempt\u 1466700620679\u 0019\u r\u000000\u 0/part-r-00000
解决方法是将hcatalog的输出写入hdfs,然后再写入s3。
您可以参考aws论坛上发布的以下链接:https://forums.aws.amazon.com/thread.jspa?threadid=230544

相关问题