日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

hadoop MultipleInputs fails with ClassCastException (get fileName)

發布時間:2023/12/10 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hadoop MultipleInputs fails with ClassCastException (get fileName) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

來自:http://stackoverflow.com/questions/11130145/hadoop-multipleinputs-fails-with-classcastexception

?

Following up on my comment, the Javadocs for?TaggedInputSplit?confirms that you are probably wrongly casting the input split to a FileSplit:

/*** An {@link InputSplit} that tags another InputSplit with extra data for use* by {@link DelegatingInputFormat}s and {@link DelegatingMapper}s.*/

My guess is your setup method looks something like this:

@Override protected void setup(Context context) throws IOException,InterruptedException {FileSplit split = (FileSplit) context.getInputSplit(); }

Unfortunately?TaggedInputSplit?is not public visible, so you can't easily do an?instanceof?style check, followed by a cast and then call to?TaggedInputSplit.getInputSplit()?to get the actual underlying FileSplit. So either you'll need to update the source yourself and re-compile&deploy, post a JIRA ticket to ask this to be fixed in future version (if it already hasn't been actioned in 2+) or perform some nasty?nasty?reflection hackery to get to the underlying InputSplit

This is completely untested:

@Override protected void setup(Context context) throws IOException,InterruptedException {InputSplit split = context.getInputSplit();Class<? extends InputSplit> splitClass = split.getClass();FileSplit fileSplit = null;if (splitClass.equals(FileSplit.class)) {fileSplit = (FileSplit) split;} else if (splitClass.getName().equals("org.apache.hadoop.mapreduce.lib.input.TaggedInputSplit")) {// begin reflection hackery...try {Method getInputSplitMethod = splitClass.getDeclaredMethod("getInputSplit");getInputSplitMethod.setAccessible(true);fileSplit = (FileSplit) getInputSplitMethod.invoke(split);} catch (Exception e) {// wrap and re-throw errorthrow new IOException(e);}// end reflection hackery} }

Reflection Hackery Explained:

With TaggedInputSplit being declared protected scope, it's not visible to classes outside the?org.apache.hadoop.mapreduce.lib.input?package, and therefore you cannot reference that class in your setup method. To get around this, we perform a number of reflection based operations:

  • Inspecting the class name, we can test for the type TaggedInputSplit using it's fully qualified name

    splitClass.getName().equals("org.apache.hadoop.mapreduce.lib.input.TaggedInputSplit")

  • We know we want to call the?TaggedInputSplit.getInputSplit()?method to recover the wrapped input split, so we utilize the?Class.getMethod(..)?reflection method to acquire a reference to the method:

    Method getInputSplitMethod = splitClass.getDeclaredMethod("getInputSplit");

  • The class still isn't public visible so we use the setAccessible(..) method to override this, stopping the security manager from throwing an exception

    getInputSplitMethod.setAccessible(true);

  • Finally we invoke the method on the reference to the input split and cast the result to a FileSplit (optimistically hoping its a instance of this type!):

    fileSplit = (FileSplit) getInputSplitMethod.invoke(split);

  • 轉載于:https://www.cnblogs.com/sunxucool/p/3727200.html

    總結

    以上是生活随笔為你收集整理的hadoop MultipleInputs fails with ClassCastException (get fileName)的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 国产伦精品一区二区三区千人斩 | 日日碰日日摸 | 男朋友是消防员第一季 | 在线观看 中文字幕 | 亚洲av无码国产精品色午夜 | 99精品视频在线观看 | 五十路中出| 精品一区二区三区毛片 | 欧美日韩不卡 | 男女视频在线免费观看 | 免费国产高清 | jizjiz中国少妇高潮水多 | 在线观看日韩欧美 | 日韩国产欧美一区二区三区 | 影音先锋啪啪 | 亚洲一区二区三区四区五区午夜 | 亚洲黄色免费电影 | 色香影院| 国产在线精品成人欧美 | 欧美日韩综合一区二区三区 | 亚洲网站免费 | 天天综合视频 | 天天舔天天摸 | 久久久久久无码精品大片 | 一级淫片免费看 | 视频h在线 | 91好色先生tv | 高清一区二区三区视频 | 性欧美video另类hd尤物 | 国产成人精品一区二区无码呦 | 丰满熟妇肥白一区二区在线 | 麻豆av电影网 | 麻豆电影网站 | 动漫美女被吸乳奶动漫视频 | 中文在线天堂网 | 欧美性生活网站 | 久久精品欧美视频 | 久久久久久久久久久久久久久久久久久久 | 欧美日一本 | 91在线精品秘密一区二区 | 日韩极品视频 | avtt男人天堂 | 美脚の诱脚舐め脚视频播放 | 爱情岛论坛永久入址测速 | 99久久久久成人国产免费 | 日韩精品无 | www.17c.com喷水少妇 | 91精品国产日韩91久久久久久 | 91精品黄色 | 丁香婷婷六月 | 8x8ⅹ国产精品一区二区 | 色偷偷888欧美精品久久久 | 好吊日在线 | 日韩欧美在线观看一区二区三区 | 雷电将军和丘丘人繁衍后代视频 | japanese在线 | 污网站免费观看 | 成人久色 | 欧美爽爽| 天天综合日日夜夜 | 中文字幕精品久久久 | 精品乱| 少妇人妻一级a毛片 | 97在线观看免费高清 | 国产精品一品二品 | 精品在线观看视频 | 亚洲第九十七页 | 一区二区免费在线 | 色黄大色黄女片免费中国 | 国产精品一级 | 久久成人国产精品 | 天狂传说之巴啦啦小魔仙 | 亚洲综合色av | 免费av的网站 | 性高潮网站 | 小小姑娘电影大全免费播放 | 国产精品久久久久一区二区三区 | 色天天干 | 亚洲成a人 | 国自产拍偷拍精品啪啪一区二区 | 久操视频免费在线观看 | 狠狠躁夜夜躁av无码中文幕 | 国产大片一区二区三区 | 精品视频久久久 | 中文字幕一区二区三区免费视频 | 国产不卡一 | 国产免费观看一区 | 我们2018在线观看免费版高清 | 日韩精品免费在线观看 | 美女免费视频网站 | 欧美69久成人做爰视频 | 成年人黄色大全 | 生活片av | 又黄又色的网站 | 精品99在线 | 亚洲视频自拍偷拍 | 美女视频一区二区三区 | 色七七网站 | 国产奶头好大揉着好爽视频 |