code: private static Map<String, Type> flatten(Schema schema) throws SchemaConversionException {
      Map<String, Type> flattened = new LinkedHashMap<>();
      Schema recordSchema = determineType(schema);
  
      Preconditions.checkArgument(Type.RECORD.equals(recordSchema.getType()), "%s is expected. Schema: %s",
          Type.RECORD, recordSchema);
  
      for (Field f : recordSchema.getFields()) {
        produceFlattenedHelper(f, flattened);
      }
      return flattened;
    }
docs: Flattens Avro's (possibly recursive) structure and provides field name and type.
  It assumes that the leaf level field name has unique name.
  @param schema
  @return
  @throws SchemaConversionException if there's duplicate name in leaf level of Avro Schema