fix NPE in IndexGeneratorJob (#4371)

* fix NPE in IndexGeneratorJob

* address review comment

* review comments
This commit is contained in:
Himanshu 2017-06-07 07:54:03 -05:00 committed by Slim
parent 2d15215cd0
commit 4ace65a2af
1 changed files with 1 additions and 1 deletions

View File

@ -454,7 +454,7 @@ public class IndexGeneratorJob implements Jobby
final ByteBuffer bytes = ByteBuffer.wrap(bytesWritable.getBytes()); final ByteBuffer bytes = ByteBuffer.wrap(bytesWritable.getBytes());
bytes.position(4); // Skip length added by SortableBytes bytes.position(4); // Skip length added by SortableBytes
int shardNum = bytes.getInt(); int shardNum = bytes.getInt();
if (config.get("mapred.job.tracker").equals("local")) { if ("local".equals(config.get("mapreduce.jobtracker.address")) || "local".equals(config.get("mapred.job.tracker"))) {
return shardNum % numPartitions; return shardNum % numPartitions;
} else { } else {
if (shardNum >= numPartitions) { if (shardNum >= numPartitions) {