### Question:
OrcStruct implements Writable { public void setFieldValue(int fieldIndex, Object value) { fields[fieldIndex] = value; } OrcStruct();  OrcStruct(List<String> fieldNames); Object getFieldValue(int fieldIndex); void setFieldValue(int fieldIndex, Object value); int getNumFields(); List<String> getFieldNames(); void setFieldNames(List<String> fieldNames); void appendField(String fieldName); @Override void write(DataOutput dataOutput); @Override void readFields(DataInput dataInput); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testInspectorFromTypeInfo() throws Exception { TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString("struct<c1:boolean,c2:tinyint" + ",c3:smallint,c4:int,c5:bigint,c6:float,c7:double,c8:binary," + "c9:string,c10:struct<c1:int>,c11:map<int,int>,c12:uniontype<int>" + ",c13:array<timestamp>>"); StructObjectInspector inspector = (StructObjectInspector) OrcLazyObjectInspectorUtils.createWritableObjectInspector(typeInfo); assertEquals("struct<c1:boolean,c2:tinyint,c3:smallint,c4:int,c5:" + "bigint,c6:float,c7:double,c8:binary,c9:string,c10:struct<" + "c1:int>,c11:map<int,int>,c12:uniontype<int>,c13:array<timestamp>>", inspector.getTypeName()); assertEquals(null, inspector.getAllStructFieldRefs().get(0).getFieldComment()); assertEquals(null, inspector.getStructFieldRef("UNKNOWN")); final List<String> fieldNames = ImmutableList.of( "field0", "field1", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9", "field10", "field11", "field12"); OrcStruct s1 = new OrcStruct(fieldNames); for(int i=0; i < 13; ++i) { s1.setFieldValue(i, i); } final List<Object> list = ImmutableList.of( (Object)0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); assertEquals(list, inspector.getStructFieldsDataAsList(s1)); ListObjectInspector listOI = (ListObjectInspector) inspector.getAllStructFieldRefs().get(12).getFieldObjectInspector(); assertEquals(ObjectInspector.Category.LIST, listOI.getCategory()); assertEquals(10, listOI.getListElement(list, 10)); assertEquals(13, listOI.getListLength(list)); final Map<Integer, Integer> map = ImmutableMap.of(1,2, 2,4, 3,6); MapObjectInspector mapOI = (MapObjectInspector) inspector.getAllStructFieldRefs().get(10).getFieldObjectInspector(); assertEquals(3, mapOI.getMapSize(map)); assertEquals(4, mapOI.getMapValueElement(map, 2)); }