Advertisement
Guest User

Untitled

a guest
Apr 24th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. Configuration config = HBaseConfiguration.create();
  2. Job job = new Job(config, "ExampleRead");
  3. job.setJarByClass(MyReadJob.class); // class that contains mapper
  4.  
  5. Scan scan = new Scan();
  6. scan.setCaching(500); // 1 is the default in Scan, which will be bad for MapReduce jobs
  7. scan.setCacheBlocks(false); // don't set to true for MR jobs
  8. // set other scan attrs
  9. ...
  10.  
  11. TableMapReduceUtil.initTableMapperJob(
  12. tableName, // input HBase table name
  13. scan, // Scan instance to control CF and attribute selection
  14. MyMapper.class, // mapper
  15. null, // mapper output key
  16. null, // mapper output value
  17. job);
  18. job.setOutputFormatClass(NullOutputFormat.class); // because we aren't emitting anything from mapper
  19.  
  20. boolean b = job.waitForCompletion(true);
  21. if (!b) {
  22. throw new IOException("error with job!");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement