public Row toSnakeCase() {
    return getSchema().getFields().stream()
        .map(
            field -> {
              if (field.getType().getRowSchema() != null) {
                Row innerRow = getValue(field.getName());
                if (innerRow != null) {
                  return innerRow.toSnakeCase();
                }
              }
              return (Object) getValue(field.getName());
            })
        .collect(toRow(getSchema().toSnakeCase()));
  }
@Test
  public void testToSnakeCase() {
    Schema innerSchema =
        Schema.builder()
            .addStringField("myFirstNestedStringField")
            .addStringField("mySecondNestedStringField")
            .build();
    Schema schema =
        Schema.builder()
            .addStringField("myFirstStringField")
            .addStringField("mySecondStringField")
            .addRowField("myRowField", innerSchema)
            .build();

    Row innerRow = Row.withSchema(innerSchema).addValues("nested1", "nested2").build();
    Row row = Row.withSchema(schema).addValues("str1", "str2", innerRow).build();

    Row expectedSnakeCaseInnerRow =
        Row.withSchema(innerSchema.toSnakeCase()).addValues("nested1", "nested2").build();
    Row expectedSnakeCaseRow =
        Row.withSchema(schema.toSnakeCase())
            .addValues("str1", "str2", expectedSnakeCaseInnerRow)
            .build();

    assertEquals(expectedSnakeCaseInnerRow, row.toSnakeCase().getRow("my_row_field"));
    assertEquals(expectedSnakeCaseRow, row.toSnakeCase());
  }