InputFormat / OutputFormat 類別架構

1 篇文章 / 0 new
author
InputFormat / OutputFormat 類別架構
► InputFormat
NLineInputFormat : 以指定傳入map的行數為單位進行資料分割處理
job.getConfiguration().set("mapreduce.input.lineinputformat.linespermap","300");//每個map處理300行
job.setInputFormatClass(NLineInputFormat.class);
SequenceFile : 二進制檔案格式, 內含同步標籤因此可分段進行資料壓縮
MultipleInputs : 同時多種資料格式輸入
MultipleInputs.addInputPath(job, path, inputFormatClass); //多種格式輸入源提供給同類 map
MultipleInputs.addInputPath(job, path, inputFormatClass, mapperClass); //各種別輸入源有各自的接收 map
DBInputFormat : 透過JDBC連接資料庫, 使用時須注意資料庫的連線負荷量
►OutputFormat
LazyOutputFormat : 當driver 加入下行內容後, 若實際無資料輸出時, 檔案並不會建立
LazyOutputFormat.setOutputFormatClass(job, TextOutputFormat.class);
from O'reilly - Hadoop.The.Definitive.Guide
Free Web Hosting