code: private static String valueString(Object value, Schema schema) {
      if (value == null || schema.getType() == Schema.Type.NULL) {
        return null;
      }
  
      switch (schema.getType()) {
        case BOOLEAN:
        case FLOAT:
        case DOUBLE:
        case INT:
        case LONG:
        case STRING:
          return value.toString();
        case ENUM:
          // serialize as the ordinal from the schema
          return String.valueOf(schema.getEnumOrdinal(value.toString()));
        case UNION:
          int index = ReflectData.get().resolveUnion(schema, value);
          return valueString(value, schema.getTypes().get(index));
        default:
          // FIXED, BYTES, MAP, ARRAY, RECORD are not supported
          throw new DatasetOperationException(
              "Unsupported field type:" + schema.getType());
      }
    }
docs: Returns a the value as the first matching schema type or null.
  
  Note that if the value may be null even if the schema does not allow the
  value to be null.
  
  @param value a value
  @param schema a Schema
  @return a String representation of the value according to the Schema type