steveniemitz commented on code in PR #22718:
URL: https://github.com/apache/beam/pull/22718#discussion_r984824672


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java:
##########
@@ -573,6 +577,60 @@ public static TypedRead<TableRow> 
readTableRowsWithSchema() {
             BigQueryUtils.tableRowFromBeamRow());
   }
 
+  @VisibleForTesting
+  static class GenericDatumTransformer<T> implements DatumReader<T> {
+    private final SerializableFunction<SchemaAndRecord, T> parseFn;
+    private final TableSchema tableSchema;
+    private final GenericDatumReader<T> reader;
+    private org.apache.avro.Schema writerSchema;
+
+    public GenericDatumTransformer(
+        SerializableFunction<SchemaAndRecord, T> parseFn,
+        TableSchema tableSchema,
+        org.apache.avro.Schema writer,
+        org.apache.avro.Schema reader) {
+      this.parseFn = parseFn;
+      this.tableSchema = tableSchema;
+      this.setSchema(writer);
+      this.reader = new GenericDatumReader<>(this.writerSchema, reader);
+    }
+
+    @Override
+    public void setSchema(org.apache.avro.Schema schema) {
+      this.writerSchema = schema;

Review Comment:
   same idea here w/ recreating the reader



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to