private void initAvroObjectInspector(ObjectInspector oi) {
    // Check for a list. If found, recursively init its members
    if (oi instanceof ListObjectInspector) {
      ListObjectInspector loi = (ListObjectInspector) oi;

      initAvroObjectInspector(loi.getListElementObjectInspector());
      return;
    }

    // Check for a nested message. If found, set the schema, else return.
    if (!(oi instanceof AvroLazyObjectInspector)) {
      return;
    }

    AvroLazyObjectInspector aoi = (AvroLazyObjectInspector) oi;

    aoi.setSchemaRetriever(avroSchemaRetriever);
    aoi.setReaderSchema(schema);

    // call the method recursively over all the internal fields of the given avro
    // objectinspector
    for (StructField field : aoi.getAllStructFieldRefs()) {
      initAvroObjectInspector(field.getFieldObjectInspector());
    }
  }
Recursively initialize the {@link AvroLazyObjectInspector} and all its nested ois

@param oi ObjectInspector to be recursively initialized
@param schema {@link Schema} to be initialized with
@param schemaRetriever class to be used to retrieve schema
hbase-handler/src/java/org/apache/hadoop/hive/hbase/struct/AvroHBaseValueFactory.java