scan.setStartRow(Bytes.toBytes(startKey));
}
if (endKey != null && !endKey.equals("")) {
scan.setStopRow(Bytes.toBytes(endKey));
}
scan.setFilter(new FirstKeyOnlyFilter());
if (sb.length() > 0) {
for (String columnName : sb.toString().trim().split(" ")) {
String [] fields = columnName.split(":");
if(fields.length == 1) {
scan.addFamily(Bytes.toBytes(fields[0]));
} else {
byte[] qualifier = Bytes.toBytes(fields[1]);
qualifiers.add(qualifier);
scan.addColumn(Bytes.toBytes(fields[0]), qualifier);
}
}
}
// specified column may or may not be part of first key value for the row.
// Hence do not use FirstKeyOnlyFilter if scan has columns, instead use
// FirstKeyValueMatchingQualifiersFilter.
if (qualifiers.size() == 0) {
scan.setFilter(new FirstKeyOnlyFilter());
} else {
scan.setFilter(new FirstKeyValueMatchingQualifiersFilter(qualifiers));
}
job.setOutputFormatClass(NullOutputFormat.class);
TableMapReduceUtil.initTableMapperJob(tableName, scan,