错误 1066:无法打开别名的迭代器 - PIG SCRIPT
Posted
技术标签:
【中文标题】错误 1066:无法打开别名的迭代器 - PIG SCRIPT【英文标题】:ERROR 1066: Unable to open iterator for alias- PIG SCRIPT 【发布时间】:2016-09-11 09:38:37 【问题描述】:我长期以来一直面临这个问题。我试图解决这个问题,但我做不到。我需要一些专家的建议来解决这个问题。
我正在尝试加载示例推文 json 文件。
sample.json;-
"filter_level":"low","retweeted":false,"in_reply_to_screen_name":"FilmFan","truncated":false,"lang":"en","in_reply_to_status_id_str":null,"id":689085590822891521,"in_reply_to_user_id_str":"6048122","timestamp_ms":"1453125782100","in_reply_to_status_id":null,"created_at":"Mon Jan 18 14:03:02 +0000 2016","favorite_count":0,"place":null,"coordinates":null,"text":"@filmfan hey its time for you guys follow @acadgild To #AchieveMore and participate in contest Win Rs.500 worth vouchers","contributors":null,"geo":null,"entities":"symbols":[],"urls":[],"hashtags":["text":"AchieveMore","indices":[56,68]],"user_mentions":["id":6048122,"name":"Tanya","indices":[0,8],"screen_name":"FilmFan","id_str":"6048122","id":2649945906,"name":"ACADGILD","indices":[42,51],"screen_name":"acadgild","id_str":"2649945906"],"is_quote_status":false,"source":"<a href=\"https://about.twitter.com/products/tweetdeck\" rel=\"nofollow\">TweetDeck<\/a>","favorited":false,"in_reply_to_user_id":6048122,"retweet_count":0,"id_str":"689085590822891521","user":"location":"India ","default_profile":false,"profile_background_tile":false,"statuses_count":86548,"lang":"en","profile_link_color":"94D487","profile_banner_url":"https://pbs.twimg.com/profile_banners/197865769/1436198000","id":197865769,"following":null,"protected":false,"favourites_count":1002,"profile_text_color":"000000","verified":false,"description":"Proud Indian, Digital Marketing Consultant,Traveler, Foodie, Adventurer, Data Architect, Movie Lover, Namo Fan","contributors_enabled":false,"profile_sidebar_border_color":"000000","name":"Bahubali","profile_background_color":"000000","created_at":"Sat Oct 02 17:41:02 +0000 2010","default_profile_image":false,"followers_count":4467,"profile_image_url_https":"https://pbs.twimg.com/profile_images/664486535040000000/GOjDUiuK_normal.jpg","geo_enabled":true,"profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","follow_request_sent":null,"url":null,"utc_offset":19800,"time_zone":"Chennai","notifications":null,"profile_use_background_image":false,"friends_count":810,"profile_sidebar_fill_color":"000000","screen_name":"Ashok_Uppuluri","id_str":"197865769","profile_image_url":"http://pbs.twimg.com/profile_images/664486535040000000/GOjDUiuK_normal.jpg","listed_count":50,"is_translator":false
我已尝试使用 ELEPHANT BIRD
加载此 json 文件脚本:-
REGISTER json-simple-1.1.1.jar
REGISTER elephant-bird-2.2.3.jar
REGISTER guava-11.0.2.jar
REGISTER avro-1.7.7.jar
REGISTER piggybank-0.12.0.jar
twitter = LOAD 'sample.json' USING com.twitter.elephantbird.pig.load.JsonLoader();
B = foreach twitter generate (chararray)$0#'created_at' as created_at,(chararray)$0#'id' as id,(chararray)$0#'id_str' as id_str,(chararray)$0#'text' as text,(chararray)$0#'source' as source,com.twitter.elephantbird.pig.piggybank.JsonStringToMap($0#'entities') as entities,(boolean)$0#'favorited' as favorited;
describe B;
输出:-
B: created_at: chararray,id: chararray,id_str: chararray,text: chararray,source: chararray,entitis: map[chararray],favorited: boolean
但是当我尝试DUMP B时,发生了以下错误
错误 org.apache.pig.tools.grunt.Grunt - 错误 1066:无法打开别名 B 的迭代器
我在这里提供完整的日志。
2016-09-11 14:07:57,184 [主要] 信息 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer - 优化前的 MR 计划大小:1 2016-09-11 14:07:57,184 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer - 优化后的 MR 计划大小:1 2016-09-11 14:07:57,194 [main] INFO org.apache.hadoop.metrics.jvm.JvmMetrics - 无法初始化 JVM processName=JobTracker, sessionId= 的指标 - 已经初始化 2016-09-11 14:07:57,194 [主要] 信息 org.apache.pig.tools.pigstats.mapreduce.MRScriptState - Pig 脚本 设置已添加到作业 2016-09-11 14:07:57,194 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - mapred.job.reduce.markreset.buffer.percent 未设置,设置为默认值 0.3 2016-09-11 14:07:57,199 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobControlCompiler - 设置单个商店作业 2016-09-11 14:07:57,199 [main] INFO org.apache.pig.data.SchemaTupleFrontend - 键 [pig.schematuple] 是 false,不会生成代码。 2016-09-11 14:07:57,199 [主要] 信息 org.apache.pig.data.SchemaTupleFrontend - 启动进程移动 生成代码到分布式 cacche 2016-09-11 14:07:57,199 [main] INFO org.apache.pig.data.SchemaTupleFrontend - 分布式缓存不是 在本地模式下支持或需要。设置键 [pig.schematuple.local.dir] 带有代码临时目录: /tmp/1473583077199-0 2016-09-11 14:07:57,206 [主要] 信息 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 1 个 map-reduce 作业等待提交。 2016-09-11 14:07:57,207 [JobControl] 信息 org.apache.hadoop.metrics.jvm.JvmMetrics - 不能 使用 processName=JobTracker, sessionId= 初始化 JVM Metrics - 已经初始化 2016-09-11 14:07:57,208 [JobControl] 警告 org.apache.hadoop.mapreduce.JobResourceUploader - 没有设置作业 jar 文件。 可能找不到用户类。请参阅 Job 或 Job#setJar(String)。 2016-09-11 14:07:57,211 [作业控制] 信息 org.apache.hadoop.mapreduce.lib.input.FileInputFormat - 总输入 处理路径:1 2016-09-11 14:07:57,211 [JobControl] INFO org.apache.pig.backend.hadoop.executionengine.util.MapRedUtil - 总计 处理的输入路径(组合):1 2016-09-11 14:07:57,212 [JobControl] INFO org.apache.hadoop.mapreduce.JobSubmitter - 数量 拆分:1 2016-09-11 14:07:57,216 [JobControl] 信息 org.apache.hadoop.mapreduce.JobSubmitter - 提交作业令牌: job_local360376249_0009 2016-09-11 14:07:57,267 [作业控制] 信息 org.apache.hadoop.mapreduce.Job - 跟踪作业的 url: http://localhost:8080/ 2016-09-11 14:07:57,267 [Thread-214] 信息 org.apache.hadoop.mapred.LocalJobRunner - OutputCommitter 设置在 配置空 2016-09-11 14:07:57,270 [Thread-214] 信息 org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter - 文件 Output Committer Algorithm version is 1 2016-09-11 14:07:57,270 [线程 214] 信息 org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter - FileOutputCommitter 跳过清理输出下的 _temporary 文件夹 目录:false,忽略清理失败:false 2016-09-11 14:07:57,270 [Thread-214] 信息 org.apache.hadoop.mapred.LocalJobRunner - OutputCommitter 是 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputCommitter 2016-09-11 14:07:57,271 [线程 214] 信息 org.apache.hadoop.mapred.LocalJobRunner - 等待地图任务 2016-09-11 14:07:57,272 [LocalJobRunner Map Task Executor #0] INFO org.apache.hadoop.mapred.LocalJobRunner - 启动任务: 尝试_本地360376249_0009_m_000000_0 2016-09-11 14:07:57,277 [LocalJobRunner Map Task Executor #0] INFO org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter - 文件 输出提交者算法版本为 1 2016-09-11 14:07:57,277 [LocalJobRunner Map Task Executor #0] INFO org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter - FileOutputCommitter 跳过清理输出下的 _temporary 文件夹 目录:false,忽略清理失败:false 2016-09-11 14:07:57,277 [LocalJobRunner Map Task Executor #0] INFO org.apache.hadoop.mapred.Task - 使用 ResourceCalculatorProcessTree : [] 2016-09-11 14:07:57,278 [LocalJobRunner 地图任务执行器#0] 信息 org.apache.hadoop.mapred.MapTask - 处理拆分:拆分数 :1 总长度 = 2416 输入拆分 [0]:长度 = 2416 类名: org.apache.hadoop.mapreduce.lib.input.FileSplit 位置: ----------------------- 2016-09-11 14:07:57,282 [LocalJobRunner Map Task Executor #0] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigRecordReader - 当前正在处理的拆分文件:/root/PIG/PIG/sample.json:0+2416 2016-09-11 14:07:57,282 [LocalJobRunner Map Task Executor #0] INFO org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter - 文件 输出提交者算法版本为 1 2016-09-11 14:07:57,282 [LocalJobRunner Map Task Executor #0] INFO org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter - FileOutputCommitter 跳过清理输出下的 _temporary 文件夹 目录:false,忽略清理失败:false 2016-09-11 14:07:57,288 [LocalJobRunner Map Task Executor #0] INFO org.apache.pig.data.SchemaTupleBackend - 键 [pig.schematuple] 不是 set... 不会生成代码。 2016-09-11 14:07:57,290 [LocalJobRunner 映射任务执行器#0] 信息 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapOnly$Map - 每个作业阶段处理的别名(AliasName[line,offset]):M: twitter[20,10],B[21,4] C: R: 2016-09-11 14:07:57,291 [Thread-214]信息 org.apache.hadoop.mapred.LocalJobRunner - 映射任务执行器完成。 2016-09-11 14:07:57,296 [Thread-214] 警告 org.apache.hadoop.mapred.LocalJobRunner - job_local360376249_0009 java.lang.Exception:java.lang.IncompatibleClassChangeError:找到 接口 org.apache.hadoop.mapreduce.Counter,但需要类 在 org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462) 在 org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522) 引起:java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.Counter,但课程预计在 com.twitter.elephantbird.pig.util.PigCounterHelper.incrCounter(PigCounterHelper.java:55) 在 com.twitter.elephantbird.pig.load.LzoBaseLoadFunc.incrCounter(LzoBaseLoadFunc.java:70) 在 com.twitter.elephantbird.pig.load.JsonLoader.getNext(JsonLoader.java:130) 在 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigRecordReader.nextKeyValue(PigRecordReader.java:204) 在 org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556) 在 org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80) 在 org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91) 在 org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145) 在 org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787) 在 org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) 在 org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:243) 在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 在 java.util.concurrent.FutureTask.run(FutureTask.java:266) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 在 java.lang.Thread.run(Thread.java:745) 2016-09-11 14:07:57,467 [主要] 信息 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - HadoopJobId:job_local360376249_0009 2016-09-11 14:07:57,467 [主要] 信息 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 处理别名 B,twitter 2016-09-11 14:07:57,467 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 详细位置:M: twitter[20,10],B[21,4] C: R: 2016-09-11 14:07:57,468 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 0% 完成 2016-09-11 14:07:57,468 [main] WARN org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 哎呀!有些工作失败了!如果您希望 Pig 在失败时立即停止,请指定 -stop_on_failure。 2016-09-11 14:07:57,468 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 作业 job_local360376249_0009 失败!停止运行所有相关作业 2016-09-11 14:07:57,468 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 100% 完成 2016-09-11 14:07:57,469 [main] INFO org.apache.hadoop.metrics.jvm.JvmMetrics - 无法初始化 JVM processName=JobTracker, sessionId= 的指标 - 已经初始化 2016-09-11 14:07:57,469 [主要] 信息 org.apache.hadoop.metrics.jvm.JvmMetrics - 无法初始化 JVM processName=JobTracker, sessionId= 的指标 - 已经初始化 2016-09-11 14:07:57,469 [主要] 错误 org.apache.pig.tools.pigstats.mapreduce.MRPigStatsUtil - 1 地图减少 作业失败! 2016-09-11 14:07:57,470 [主要] 信息 org.apache.pig.tools.pigstats.mapreduce.SimplePigStats - 脚本 统计:HadoopVersionPigVersionUserIdStartedAtFinishedAtFeatures 2.7.1.2.3.4.7-40.15.0.2.3.4.7-4root2016-09-11 14:07:572016-09-11 14:07:57UNKNOWN 失败!失败的作业:JobIdAliasFeatureMessageOutputs job_local360376249_0009B,twitterMAP_ONLYMessage:工作 失败!文件:/tmp/temp252944192/tmp-470484503,输入:读取失败 来自“file:///root/PIG/PIG/sample.json”的数据输出:失败 在“file:/tmp/temp252944192/tmp-470484503”中产生结果 写入的总记录:0 写入的总字节数:0 溢出内存 经理溢出计数:0 主动溢出的袋子总数:0 总计 主动泄露的记录:0 Job DAG:job_local360376249_0009
并请说明如何使用 jar 文件,
以及要使用哪些版本。我很困惑该使用哪个版本。
有人说用象鸟,有人说用 AVRO。但我和他们都没有工作。
请帮忙。
莫汉.V
【问题讨论】:
【参考方案1】:我自己搞定的。 这是jar版本问题。 脚本:-
REGISTER elephant-bird-core-4.1.jar
REGISTER elephant-bird-pig-4.1.jar
REGISTER elephant-bird-hadoop-compat-4.1.jar
而且效果很好。
【讨论】:
以上是关于错误 1066:无法打开别名的迭代器 - PIG SCRIPT的主要内容,如果未能解决你的问题,请参考以下文章
错误 1066:无法打开别名的迭代器 - PIG SCRIPT