getStructFieldRef("int1").getFieldObjectInspector();
LongObjectInspector lo = (LongObjectInspector) readerInspector.
getStructFieldRef("long1").getFieldObjectInspector();
FloatObjectInspector fl = (FloatObjectInspector) readerInspector.
getStructFieldRef("float1").getFieldObjectInspector();
DoubleObjectInspector dbl = (DoubleObjectInspector) readerInspector.
getStructFieldRef("double1").getFieldObjectInspector();
BinaryObjectInspector bi = (BinaryObjectInspector) readerInspector.
getStructFieldRef("bytes1").getFieldObjectInspector();
StringObjectInspector st = (StringObjectInspector) readerInspector.
getStructFieldRef("string1").getFieldObjectInspector();
StructObjectInspector mid = (StructObjectInspector) readerInspector.
getStructFieldRef("middle").getFieldObjectInspector();
List<? extends StructField> midFields =
mid.getAllStructFieldRefs();
ListObjectInspector midli =
(ListObjectInspector) midFields.get(0).getFieldObjectInspector();
StructObjectInspector inner = (StructObjectInspector)
midli.getListElementObjectInspector();
List<? extends StructField> inFields = inner.getAllStructFieldRefs();
ListObjectInspector li = (ListObjectInspector) readerInspector.
getStructFieldRef("list").getFieldObjectInspector();
MapObjectInspector ma = (MapObjectInspector) readerInspector.
getStructFieldRef("map").getFieldObjectInspector();
StringObjectInspector mk = (StringObjectInspector)
ma.getMapKeyObjectInspector();
RecordReader rows = reader.rows();
Object row = rows.next(null);
assertNotNull(row);
// check the contents of the first row
assertEquals(false,
bo.get(readerInspector.getStructFieldData(row, fields.get(0))));
assertEquals(1, by.get(readerInspector.getStructFieldData(row,
fields.get(1))));
assertEquals(1024, sh.get(readerInspector.getStructFieldData(row,
fields.get(2))));
assertEquals(65536, in.get(readerInspector.getStructFieldData(row,
fields.get(3))));
assertEquals(Long.MAX_VALUE, lo.get(readerInspector.
getStructFieldData(row, fields.get(4))));
assertEquals(1.0, fl.get(readerInspector.getStructFieldData(row,
fields.get(5))), 0.00001);
assertEquals(-15.0, dbl.get(readerInspector.getStructFieldData(row,
fields.get(6))), 0.00001);
assertEquals(bytes(0,1,2,3,4), bi.getPrimitiveWritableObject(
readerInspector.getStructFieldData(row, fields.get(7))));
assertEquals("hi", st.getPrimitiveJavaObject(readerInspector.
getStructFieldData(row, fields.get(8))));
List<?> midRow = midli.getList(mid.getStructFieldData(readerInspector.
getStructFieldData(row, fields.get(9)), midFields.get(0)));
assertNotNull(midRow);
assertEquals(2, midRow.size());
assertEquals(1, in.get(inner.getStructFieldData(midRow.get(0),
inFields.get(0))));
assertEquals("bye", st.getPrimitiveJavaObject(inner.getStructFieldData
(midRow.get(0), inFields.get(1))));
assertEquals(2, in.get(inner.getStructFieldData(midRow.get(1),
inFields.get(0))));
assertEquals("sigh", st.getPrimitiveJavaObject(inner.getStructFieldData
(midRow.get(1), inFields.get(1))));
List<?> list = li.getList(readerInspector.getStructFieldData(row,
fields.get(10)));
assertEquals(2, list.size());
assertEquals(3, in.get(inner.getStructFieldData(list.get(0),
inFields.get(0))));
assertEquals("good", st.getPrimitiveJavaObject(inner.getStructFieldData
(list.get(0), inFields.get(1))));
assertEquals(4, in.get(inner.getStructFieldData(list.get(1),
inFields.get(0))));
assertEquals("bad", st.getPrimitiveJavaObject(inner.getStructFieldData
(list.get(1), inFields.get(1))));
Map<?,?> map = ma.getMap(readerInspector.getStructFieldData(row,
fields.get(11)));
assertEquals(0, map.size());
// check the contents of second row
assertEquals(true, rows.hasNext());
row = rows.next(row);
assertEquals(true,
bo.get(readerInspector.getStructFieldData(row, fields.get(0))));
assertEquals(100, by.get(readerInspector.getStructFieldData(row,
fields.get(1))));
assertEquals(2048, sh.get(readerInspector.getStructFieldData(row,
fields.get(2))));
assertEquals(65536, in.get(readerInspector.getStructFieldData(row,
fields.get(3))));
assertEquals(Long.MAX_VALUE, lo.get(readerInspector.
getStructFieldData(row, fields.get(4))));
assertEquals(2.0, fl.get(readerInspector.getStructFieldData(row,
fields.get(5))), 0.00001);
assertEquals(-5.0, dbl.get(readerInspector.getStructFieldData(row,
fields.get(6))), 0.00001);
assertEquals(bytes(), bi.getPrimitiveWritableObject(
readerInspector.getStructFieldData(row, fields.get(7))));
assertEquals("bye", st.getPrimitiveJavaObject(readerInspector.
getStructFieldData(row, fields.get(8))));