Advertisement
Guest User

Untitled

a guest
Aug 8th, 2011
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public class FooBarMultipleTextOutputFormat
  2. extends MultipleTextOutputFormat<NullWritable, Text> {
  3.  
  4. protected String generateFileNameForKeyValue(NullWritable key,
  5. Text value,
  6. String name) {
  7. String line = value.toString();
  8.  
  9. //TODO: I would like to parameterize the field that is picked
  10. //here. Something akin to using JobConf in Mapper.
  11. //i.e. instead of hard-coding [3] or [0], I would like
  12. //to get it from JobConf(or some other configuration) in some fashion
  13.  
  14. String date = (line.split("\t"))[3].substring(0,10);
  15. String id = (line.split("\t"))[0];
  16.  
  17. String partitionNumber = String.format("%05d", ID.getPartitionNumber(id));
  18.  
  19. return date + "/pn_" + partitionNumber;
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement