use of org.apache.hadoop.hive.accumulo.columns.HiveAccumuloColumnMapping in project hive by apache.
the class LazyAccumuloRow method uncheckedGetField.
/*
* split pairs by delimiter.
*/
private Object uncheckedGetField(int id) {
if (getFieldInited()[id]) {
return getFields()[id].getObject();
}
getFieldInited()[id] = true;
ColumnMapping columnMapping = columnMappings.get(id);
LazyObjectBase field = getFields()[id];
if (columnMapping instanceof HiveAccumuloMapColumnMapping) {
HiveAccumuloMapColumnMapping mapColumnMapping = (HiveAccumuloMapColumnMapping) columnMapping;
LazyAccumuloMap map = (LazyAccumuloMap) field;
map.init(row, mapColumnMapping);
} else {
byte[] value;
if (columnMapping instanceof HiveAccumuloRowIdColumnMapping) {
// Use the rowID directly
value = row.getRowId().getBytes();
} else if (columnMapping instanceof HiveAccumuloColumnMapping) {
HiveAccumuloColumnMapping accumuloColumnMapping = (HiveAccumuloColumnMapping) columnMapping;
// Use the colfam and colqual to get the value
value = row.getValue(new Text(accumuloColumnMapping.getColumnFamilyBytes()), new Text(accumuloColumnMapping.getColumnQualifierBytes()));
} else {
log.error("Could not process ColumnMapping of type " + columnMapping.getClass() + " at offset " + id + " in column mapping: " + columnMapping.getMappingSpec());
throw new IllegalArgumentException("Cannot process ColumnMapping of type " + columnMapping.getClass());
}
if (value == null || isNull(oi.getNullSequence(), value, 0, value.length)) {
field.setNull();
} else {
ByteArrayRef ref = new ByteArrayRef();
ref.setData(value);
field.init(ref, 0, value.length);
}
}
return field.getObject();
}
Aggregations