日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Hadoop教程:HadoopMapper

主要是讀取InputSplit的每一個(gè)Key,Value對并進(jìn)行處理

十余年專注建站、設(shè)計(jì)、互聯(lián)網(wǎng)產(chǎn)品按需制作網(wǎng)站服務(wù),業(yè)務(wù)涵蓋高端網(wǎng)站設(shè)計(jì)、商城開發(fā)、微信小程序、軟件系統(tǒng)開發(fā)、手機(jī)APP定制開發(fā)等。憑借多年豐富的經(jīng)驗(yàn),我們會(huì)仔細(xì)了解每個(gè)客戶的需求而做出多方面的分析、設(shè)計(jì)、整合,為客戶設(shè)計(jì)出具風(fēng)格及創(chuàng)意性的商業(yè)解決方案,創(chuàng)新互聯(lián)公司更提供一系列網(wǎng)站制作和網(wǎng)站推廣的服務(wù),以推動(dòng)各中小企業(yè)全面信息數(shù)字化,并利用創(chuàng)新技術(shù)幫助各行業(yè)提升企業(yè)形象和運(yùn)營效率。

public class Mapper {
    /**
     * 預(yù)處理,僅在map task啟動(dòng)時(shí)運(yùn)行一次
     */
    protected void setup(Context context) throws  IOException, InterruptedException {
    }

    /**
     * 對于InputSplit中的每一對都會(huì)運(yùn)行一次
     */
    @SuppressWarnings("unchecked")
    protected void map(KEYIN key, VALUEIN value, Context context) throws IOException, InterruptedException {
        context.write((KEYOUT) key, (VALUEOUT) value);
    }

    /**
     * 掃尾工作,比如關(guān)閉流等
     */
    protected void cleanup(Context context) throws IOException, InterruptedException {
    }

    /**
     * map task的驅(qū)動(dòng)器
     */
    public void run(Context context) throws IOException, InterruptedException {
        setup(context);
        while (context.nextKeyValue()) {
            map(context.getCurrentKey(), context.getCurrentValue(), context);
        }
        cleanup(context);
    }
}

public class MapContext extends TaskInputOutputContext {
    private RecordReader reader;
    private InputSplit split;

    /**
     * Get the input split for this map.
     */
    public InputSplit getInputSplit() {
        return split;
    }

    @Override
    public KEYIN getCurrentKey() throws IOException, InterruptedException {
        return reader.getCurrentKey();
    }

    @Override
    public VALUEIN getCurrentValue() throws IOException, InterruptedException {
        return reader.getCurrentValue();
    }

    @Override
    public boolean nextKeyValue() throws IOException, InterruptedException {
        return reader.nextKeyValue();
    }
}

網(wǎng)頁標(biāo)題:創(chuàng)新互聯(lián)Hadoop教程:HadoopMapper
地址分享:http://www.5511xx.com/article/cdsoeod.html