@Override
public Object getStructFieldData(Object data, StructField fieldRef) {
if (data == null) {
return null;
}
StructObject struct = (StructObject) data;
MyField f = (MyField) fieldRef;
int fieldID = f.getFieldID();
assert (fieldID >= 0 && fieldID < fields.size());
ObjectInspector oi = f.getFieldObjectInspector();
if (oi instanceof AvroLazyObjectInspector) {
return ((AvroLazyObjectInspector) oi).getStructFieldData(data, fieldRef);
}
if (oi instanceof MapObjectInspector) {
ObjectInspector valueOI = ((MapObjectInspector) oi).getMapValueObjectInspector();
if (valueOI instanceof AvroLazyObjectInspector) {
return ((AvroLazyObjectInspector) valueOI).getStructFieldData(data, fieldRef);
}
}
return struct.getField(fieldID);
}