title: Apache Beam Coder for GenericRecord
body: <p>I am building a pipeline that reads Avro generic records. To pass GenericRecord between stages I need to register AvroCoder. The documentation says that if I use generic record, the schema argument can be arbitrary: <a href="https://beam.apache.org/releases/javadoc/2.2.0/org/apache/beam/sdk/coders/AvroCoder.html#of-java.lang.Class-org.apache.avro.Schema-" rel="nofollow noreferrer">https://beam.apache.org/releases/javadoc/2.2.0/org/apache/beam/sdk/coders/AvroCoder.html#of-java.lang.Class-org.apache.avro.Schema-</a></p>
  
  <p>However, when I pass an empty schema to the method <code>AvroCoder.of(Class, Schema)</code> it throws an exception at run time. Is there a way to create an AvroCoder for GenericRecord that does not require a schema? In my case, each GenericRecord has an embedded schema.</p>
  
  <p>The exception and stacktrace:</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
  at org.apache.beam.sdk.coders.AvroCoder$AvroDeterminismChecker.checkIndexedRecord(AvroCoder.java:562)
  at org.apache.beam.sdk.coders.AvroCoder$AvroDeterminismChecker.recurse(AvroCoder.java:430)
  at org.apache.beam.sdk.coders.AvroCoder$AvroDeterminismChecker.check(AvroCoder.java:409)
  at org.apache.beam.sdk.coders.AvroCoder.&lt;init&gt;(AvroCoder.java:260)
  at org.apache.beam.sdk.coders.AvroCoder.of(AvroCoder.java:141)
  </code></pre>