diff --git a/src/docbkx/book.xml b/src/docbkx/book.xml index 86ffcff35e4..9ac92155030 100644 --- a/src/docbkx/book.xml +++ b/src/docbkx/book.xml @@ -126,7 +126,7 @@ TableMapReduceUtil.initTableMapperJob( job.setOutputFormatClass(NullOutputFormat.class); // because we aren't emitting anything from mapper boolean b = job.waitForCompletion(true); -if ( b == false) { +if (!b) { throw new IOException("error with job!"); } @@ -169,14 +169,14 @@ TableMapReduceUtil.initTableReducerJob( job.setNumReduceTasks(0); boolean b = job.waitForCompletion(true); -if ( b == false) { - throw new IOException("error with job!"); +if (!b) { + throw new IOException("error with job!"); } An explanation is required of what TableMapReduceUtil is doing, especially with the reducer. TableOutputFormat is being used as the outputFormat class, and several parameters are being set on the config (e.g., TableOutputFormat.OUTPUT_TABLE), as - well as setting the reducer output keys to ImmutableBytesWritable and Writable. + well as setting the reducer output key to ImmutableBytesWritable and reducer value to Writable. These could be set by the programmer on the job and conf, but TableMapReduceUtil tries to make things easier. The following is the example mapper, which will create a Put and matching the input Result and emit it. Note: this is what the CopyTable utility does. @@ -189,13 +189,12 @@ public static class MyMapper extends TableMapper<ImmutableBytesWritable, Put& context.write(row, resultToPut(row,value)); } - private static Put resultToPut(ImmutableBytesWritable key, Result result) - throws IOException { - Put put = new Put(key.get()); - for (KeyValue kv : result.raw()) { - put.add(kv); - } - return put; + private static Put resultToPut(ImmutableBytesWritable key, Result result) throws IOException { + Put put = new Put(key.get()); + for (KeyValue kv : result.raw()) { + put.add(kv); + } + return put; } } @@ -235,7 +234,7 @@ TableMapReduceUtil.initTableReducerJob( job.setNumReduceTasks(1); // at least one, adjust as required boolean b = job.waitForCompletion(true); -if ( b == false) { +if (!b) { throw new IOException("error with job!"); }