piotr-szuberski commented on a change in pull request #12827:
URL: https://github.com/apache/beam/pull/12827#discussion_r495866398



##########
File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/AvroUtils.java
##########
@@ -428,6 +432,35 @@ public static GenericRecord toGenericRecord(
     return new GenericRecordToRowFn(schema);
   }
 
+  public static Row avroBytesToRow(byte[] bytes, Schema schema) {
+    try {
+      org.apache.avro.Schema avroSchema = AvroUtils.toAvroSchema(schema);
+      AvroCoder<GenericRecord> coder = AvroCoder.of(avroSchema);

Review comment:
       I had a quite hard time as AvroSchema is not serializable (and the tests 
were failing due to DoFn serialization exception), but I've learned the use 
case of transient keyword :) I've chosen the lambda way but had to define a 
class implementing SerializableFunction to be able to use transient for 
avroSchema. Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to