Guest User

Untitled

a guest
Sep 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public void map(LongWritable key, Text value, OutputCollector output, Reporter reporter) throws IOException {
  2. final String line = value.toString();
  3. final String[] parts = line.split("/");
  4.  
  5. if (parts.length > 1) {
  6. final String filename = parts[parts.length-1];
  7. final String[] fileParts = filename.split("_");
  8. final StringBuilder sb = new StringBuilder();
  9. sb.append(fileParts[1]);
  10. sb.append(fileParts[0]);
  11.  
  12. keyVal.set(sb.toString());
  13. valVal.set(line);
  14.  
  15. output.collect(keyVal, valVal);
  16. }
  17. else {
  18. reporter.incrCounter("org.apache.hadoop.mapred.Task$Counter", "MAP_SKIPPED_RECORDS", 1);
  19. }
  20. }
Add Comment
Please, Sign In to add comment