天天看點

自定義 outformat 案例實作 | 學習筆記

開發者學堂課程【Hadoop 分布式計算架構 MapReduce:自定義 outformat 案例實作】學習筆記,與課程緊密聯系,讓使用者快速學習知識。

課程位址:

https://developer.aliyun.com/learning/course/94/detail/1543

自定義 outformat 案例實作

一、案例實作

1.編寫 FilterMapper 類

自定義 outformat 案例實作 | 學習筆記

防止有重複的資料

2、輸入資料

3、自定義一個 OutputFormat 類

Return new(job)

建立

自定義 outformat 案例實作 | 學習筆記

用完一個對象,上傳資料,友善之後操作

建立兩個檔案輸出流:atguiguOut、otherOut

1、擷取檔案系統,獲得輸出流

2、建立輸出到 atguigu.log 的輸出

3.建立輸出到 other.log 的輸出

自定義 outformat 案例實作 | 學習筆記

4、判斷key當中是否 atguigu,如果有寫到 atguigu.如果沒有寫出到other.log

5、Atguigu 輸出流

6、将自定義的輸出格式設定到 job

7、指定一個輸出目錄

8、防止有重複的資料

自定義 outformat 案例實作 | 學習筆記

繼續閱讀