Thanks to help from Jeff Klukas, I just merged PR/7334 which adds schema
support to AutoValue objects.
in particular, since Beam knows how to encode any type with a schema, this
means that AutoValue objects can now be used inside of PCollections, which
has been a long-requested feature.
The simplest way to use this is to use the DefaultSchema annotation. For
example:
@DefaultSchema(AutoValueSchema.class)
@AutoValue
abstract class MyAutoValue {
public abstract String getName();
public abstract MyOtherAutoValue getOtherValue();
...
}
This will automatically register this AutoValue class in the SchemaRegistry.
If you can't add the attribute (possibly because you don't own the source
code containing the AutoValue class), you can manually register it as
follows:
pipeline.getSchemaRegistry().registerSchemaProvider(
MyAutoValue.class, new AutoValueSchema());
Let me know if you have questions or issues with this feature!
Reuven