public IcebergRecordObjectInspector(Types.StructType structType, List<ObjectInspector> objectInspectors) {
    Preconditions.checkArgument(structType.fields().size() == objectInspectors.size());

    this.structFields = Lists.newArrayListWithExpectedSize(structType.fields().size());

    int position = 0;

    for (Types.NestedField field : structType.fields()) {
      ObjectInspector oi = objectInspectors.get(position);
      Types.NestedField fieldInLowercase = Types.NestedField.of(field.fieldId(), field.isOptional(),
              field.name().toLowerCase(), field.type(), field.doc());
      IcebergRecordStructField structField = new IcebergRecordStructField(fieldInLowercase, oi, position);
      structFields.add(structField);
      position++;
    }
  }
@Test
  public void testIcebergRecordObjectInspector() {
    Schema schema = new Schema(
            required(1, "integer_field", Types.IntegerType.get()),
            required(2, "struct_field", Types.StructType.of(
                    Types.NestedField.required(3, "string_field", Types.StringType.get())))
    );

    Record record = RandomGenericData.generate(schema, 1, 0L).get(0);
    Record innerRecord = record.get(1, Record.class);

    StructObjectInspector soi = (StructObjectInspector) IcebergObjectInspector.create(schema);
    Assert.assertEquals(ImmutableList.of(record.get(0), record.get(1)), soi.getStructFieldsDataAsList(record));

    StructField integerField = soi.getStructFieldRef("integer_field");
    Assert.assertEquals(record.get(0), soi.getStructFieldData(record, integerField));

    StructField structField = soi.getStructFieldRef("struct_field");
    Object innerData = soi.getStructFieldData(record, structField);
    Assert.assertEquals(innerRecord, innerData);

    StructObjectInspector innerSoi = (StructObjectInspector) structField.getFieldObjectInspector();
    StructField stringField = innerSoi.getStructFieldRef("string_field");

    Assert.assertEquals(ImmutableList.of(innerRecord.get(0)), innerSoi.getStructFieldsDataAsList(innerRecord));
    Assert.assertEquals(innerRecord.get(0), innerSoi.getStructFieldData(innerData, stringField));
  }