LOG.warn("field number is less than " + MININUM_FIELD_NUM + " consider it as an empty line:" + line.toString(','));
continue;
}
String rowKey = line.getField(rowKeyIndex);
if (StringUtils.isEmpty(rowKey)) {
throw new WormholeException(
"hbase rowkey should not be empty",
JobStatus.WRITE_DATA_EXCEPTION.getStatus());
}
client.setRowKey(rowKey.getBytes(DEFAULT_ENCODING));
for (int i = 0; i < rowKeyIndex; i++) {
if (line.getField(i) == null) {
continue;
}
client.addColumn(columnFamilies[i], qualifiers[i], line
.getField(i).getBytes(DEFAULT_ENCODING));
}
for (int i = rowKeyIndex + 1; i < fieldNum; i++) {
if (line.getField(i) == null) {
continue;
}
client.addColumn(columnFamilies[i-1], qualifiers[i-1], line
.getField(i).getBytes(DEFAULT_ENCODING));
}
client.insert();
getMonitor().increaseSuccessLines();
}
} catch (Exception e) {
throw new WormholeException(e, JobStatus.WRITE_DATA_EXCEPTION.getStatus());
}
}