當前位置: 首頁>>代碼示例>>Java>>正文


Java SequenceFileInputFormat.addInputPaths方法代碼示例

本文整理匯總了Java中org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat.addInputPaths方法的典型用法代碼示例。如果您正苦於以下問題:Java SequenceFileInputFormat.addInputPaths方法的具體用法?Java SequenceFileInputFormat.addInputPaths怎麽用?Java SequenceFileInputFormat.addInputPaths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat的用法示例。


在下文中一共展示了SequenceFileInputFormat.addInputPaths方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createJob

import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat; //導入方法依賴的package包/類
public <T> Job createJob( Path basePath
                    , Path outputPath
                    , long beginNS
                    , long endNS
                    , int numReducers
                    , T fields
                    , Configuration conf
                    , FileSystem fs
                    , PcapFilterConfigurator<T> filterImpl
                    ) throws IOException
{
  conf.set(START_TS_CONF, Long.toUnsignedString(beginNS));
  conf.set(END_TS_CONF, Long.toUnsignedString(endNS));
  conf.set(WIDTH_CONF, "" + findWidth(beginNS, endNS, numReducers));
  filterImpl.addToConfig(fields, conf);
  Job job = Job.getInstance(conf);
  job.setJarByClass(PcapJob.class);
  job.setMapperClass(PcapJob.PcapMapper.class);
  job.setMapOutputKeyClass(LongWritable.class);
  job.setMapOutputValueClass(BytesWritable.class);
  job.setNumReduceTasks(numReducers);
  job.setReducerClass(PcapReducer.class);
  job.setPartitionerClass(PcapPartitioner.class);
  job.setOutputKeyClass(LongWritable.class);
  job.setOutputValueClass(BytesWritable.class);
  Iterable<String> filteredPaths = FileFilterUtil.getPathsInTimeRange(beginNS, endNS, listFiles(fs, basePath));
  String inputPaths = Joiner.on(',').join(filteredPaths);
  if (StringUtils.isEmpty(inputPaths)) {
    return null;
  }
  SequenceFileInputFormat.addInputPaths(job, inputPaths);
  job.setInputFormatClass(SequenceFileInputFormat.class);
  job.setOutputFormatClass(SequenceFileOutputFormat.class);
  SequenceFileOutputFormat.setOutputPath(job, outputPath);
  return job;
}
 
開發者ID:apache,項目名稱:metron,代碼行數:37,代碼來源:PcapJob.java


注:本文中的org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat.addInputPaths方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。