final String localityGroupName = Bytes.toString(hbaseColumnName.getFamily());
final LocalityGroupLayout localityGroup = mLayout.getLocalityGroupMap().get(localityGroupName);
if (localityGroup == null) {
throw new NoSuchColumnException(String.format("No locality group %s in table %s.",
localityGroupName, mLayout.getName()));
}
// Parse the HBase qualifier as a byte[] in order to save a String instantiation
final byte[] hbaseQualifier = hbaseColumnName.getQualifier();
final int index = ArrayUtils.indexOf(hbaseQualifier, SEPARATOR);
if (index == -1) {
throw new NoSuchColumnException(String.format(
"Missing separator in HBase column %s.", hbaseColumnName));
}
final String familyName = Bytes.toString(hbaseQualifier, 0, index);
final String qualifierName =
Bytes.toString(hbaseQualifier, index + 1, hbaseQualifier.length - index - 1);
final FamilyLayout family = mLayout.getFamilyMap().get(familyName);
if (family == null) {
throw new NoSuchColumnException(String.format(
"No family %s in locality group %s of table %s.",
familyName, localityGroupName, mLayout.getName()));
}
if (family.isGroupType()) {
// Group type family.
if (!family.getColumnMap().containsKey(qualifierName)) {
throw new NoSuchColumnException(String.format(
"No qualifier %s in family %s of table %s.",
qualifierName, familyName, mLayout.getName()));
}
final KijiColumnName kijiColumnName = new KijiColumnName(familyName, qualifierName);
LOG.debug("Translated to Kiji group type column {}.", kijiColumnName);