1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.chukwa.extraction.archive;
20
21
22 import java.text.SimpleDateFormat;
23 import org.apache.hadoop.chukwa.ChukwaArchiveKey;
24 import org.apache.hadoop.chukwa.ChunkImpl;
25 import org.apache.hadoop.mapred.lib.MultipleSequenceFileOutputFormat;
26 import org.apache.log4j.Logger;
27
28 public class ChukwaArchiveDailyOutputFormat extends
29 MultipleSequenceFileOutputFormat<ChukwaArchiveKey, ChunkImpl> {
30 static Logger log = Logger.getLogger(ChukwaArchiveDailyOutputFormat.class);
31 SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd");
32
33 @Override
34 protected String generateFileNameForKeyValue(ChukwaArchiveKey key,
35 ChunkImpl chunk, String name) {
36
37 if (log.isDebugEnabled()) {
38 log.debug("ChukwaArchiveOutputFormat.fileName: "
39 + sdf.format(key.getTimePartition()));
40 }
41
42 return sdf.format(key.getTimePartition()) + ".arc";
43 }
44 }