code: public static Schema switchName(Schema schema, String newName) {
      if (schema.getName().equals(newName)) {
        return schema;
      }
  
      Schema newSchema = Schema.createRecord(newName, schema.getDoc(), schema.getNamespace(), schema.isError());
  
      List<Field> fields = schema.getFields();
      Iterable<Field> fieldsNew = Iterables.transform(fields, new Function<Field, Field>() {
        @Override
        public Schema.Field apply(Field input) {
          //this should never happen but the API has marked input as Nullable
          if (null == input) {
            return null;
          }
          Field field = new Field(input.name(), input.schema(), input.doc(), input.defaultValue(), input.order());
          return field;
        }
      });
  
      newSchema.setFields(Lists.newArrayList(fieldsNew));
      return newSchema;
    }
docs: Copies the input {@link org.apache.avro.Schema} but changes the schema name.
  @param schema {@link org.apache.avro.Schema} to copy.
  @param newName name for the copied {@link org.apache.avro.Schema}.
  @return A {@link org.apache.avro.Schema} that is a copy of schema, but has the name newName.