gpt4 book ai didi

json - 使用Elephantbird读取JSON时出错-PIG

转载 作者:行者123 更新时间:2023-12-02 21:57:52 24 4
gpt4 key购买 nike

我无法使用ElephantBird和Pig读取JSON文件。我想知道我在哪里犯错。

数据:

{ "nrcpts": "1",
"src": "info@example.com",
"sendmailid": "p6D0r0u1006229",
"relay": "app03.example.com",
"classnumber": "0",
"msgid": "WARQZCXAEMSSVWPPOOYZXR
LQIKMFUY.155763@example.com",
"pid": "6229",
"month": "Jul",
"time": "20:53:00",
"day": "12",
"mailserver": "mail5",
"size": "57395"
}

码:
json1 = load '/user/hdetl/funnel/uetsample.dat' using com.twitter.elephantbird.pig.load.JsonLoader();

dat = FOREACH json1 GENERATE $0#'mailserver' AS mailserver;
dump dat;

错误:

Input(s):
Failed to read data from "/user/hdetl/funnel/uetsample.dat"

detailed error :
Pig Stack Trace
---------------
ERROR 2997: Unable to recreate exception from backed error: Error: in

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias dat. Backend error : Unable to recreate exception from back
ed error: Error: in
at org.apache.pig.PigServer.openIterator(PigServer.java:891)
at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:655)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:303)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:188)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:164)
at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69)
at org.apache.pig.Main.run(Main.java:495)
at org.apache.pig.Main.main(Main.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:186)
Caused by: org.apache.pig.backend.executionengine.ExecException: ERROR 2997: Unable to recreate exception from backed error: Error: in
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.Launcher.getErrorMessages(Launcher.java:221)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.Launcher.getStats(Launcher.java:151)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.launchPig(MapReduceLauncher.java:344)
at org.apache.pig.PigServer.launchPlan(PigServer.java:1314)
at org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1299)
at org.apache.pig.PigServer.storeEx(PigServer.java:996)
at org.apache.pig.PigServer.store(PigServer.java:963)
at org.apache.pig.PigServer.openIterator(PigServer.java:876)

最佳答案

我没有使用过JSON加载程序,但我想您应该可以在$ foreach中删除$ 0。我只是不相信加载程序只是将{和}之间的所有内容转换为单个记录(元组)。

dat = FOREACH json1生成邮件服务器;

关于json - 使用Elephantbird读取JSON时出错-PIG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9438934/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com