title: How to write Avro files from Apache Beam Row
body: <p>In my Apache Beam pipeline I have a PCollection of Row objects (org.apache.beam.sdk.values.Row). I want write to Avro files. Here is a simplified version of my code:</p>
  <pre><code>   Pipeline p = Pipeline.create();
  
      Schema inputSchema = Schema.of(
              Schema.Field.of(&quot;MyField1&quot;, Schema.FieldType.INT32)
      );
  
      Row row = Row.withSchema(inputSchema).addValues(1).build();
      PCollection&lt;Row&gt; myRow = p.apply(Create.of(row)).setCoder(RowCoder.of(inputSchema));
  
      myRow.apply(
              &quot;WriteToAvro&quot;,
              AvroIO.write(Row.class)
                      .to(&quot;src/tmp/my_files&quot;)
                      .withWindowedWrites()
                      .withNumShards(10));
      p.run();
  </code></pre>
  <p>The file gets created, but it looks like this (in JSON form):</p>
  <pre><code>&quot;schema&quot; : {
      &quot;fieldIndices&quot; : {
          &quot;MyField1&quot; : 0
      },
      &quot;encodingPositions&quot; : {
          &quot;MyField1&quot; : 0
      },
      &quot;fields&quot; : [
          {
          }
      ],
      &quot;hashCode&quot; : 545134948,
      &quot;uuid&quot; : {
      },
      &quot;options&quot; : {
          &quot;options&quot; : {
          }
      }
  }
  </code></pre>
  <p>So only the schema is there with bunch of useless metadata. What's the right way of writing to Avro from Row objects so that I have the data and not just the schema. And can I get rid of the metadata?</p>