reuvenlax commented on code in PR #41534:
URL: https://github.com/apache/beam/pull/41534#discussion_r4672927430


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWriteUnshardedRecords.java:
##########
@@ -1323,13 +1324,24 @@ DestinationState createDestinationState(
           dynamicDestinations,
           destination);
       @Nullable Coder<DestinationT> destinationCoder = 
dynamicDestinations.getDestinationCoder();
+      // Eagerly resolve schema and table constraints while 
ProcessContext/OnTimerContext is active,
+      // as dynamicDestinations may access side inputs which are not 
guaranteed to be available when
+      // tryCreateTable is invoked during @FinishBundle.
+      final com.google.api.services.bigquery.model.@Nullable TableSchema 
tableSchema =

Review Comment:
   most of the time I think this is a noop. Most of the dynamicDestination 
implementations have TableSchema already stored as a member variable, so this 
is just a copy.  Custom user DynamicDestinations might be parsing each time, 
but that's uncommon (and expensive getSchema is generally an antipattern 
anyway); if we wanted to solve that, I'd rather just add caching in 
DynamicDestinations.



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