code: private static Optional<Field> getFieldHelper(Schema schema, List<String> pathList, int field) {
      Field curField = schema.getField(pathList.get(field));
      if (field + 1 == pathList.size()) {
        return Optional.fromNullable(curField);
      }
  
      Schema fieldSchema = curField.schema();
      switch (fieldSchema.getType()) {
        case UNION:
          throw new AvroRuntimeException("Union of complex types cannot be handled : " + schema);
        case MAP:
          return AvroUtils.getFieldHelper(fieldSchema.getValueType(), pathList, ++field);
        case RECORD:
          return AvroUtils.getFieldHelper(fieldSchema, pathList, ++field);
        default:
          throw new AvroRuntimeException("Invalid type in schema : " + schema);
      }
    }
docs: Helper method that does the actual work for {@link #getField(Schema, String)}
  @param schema passed from {@link #getFieldSchema(Schema, String)}
  @param pathList passed from {@link #getFieldSchema(Schema, String)}
  @param field keeps track of the index used to access the list pathList
  @return the field