Abacn commented on code in PR #41534:
URL: https://github.com/apache/beam/pull/41534#discussion_r4670846648
##########
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:
Not sure the impact on API call pressures / serialization overhead if we
change to resolve every time. Nevertheless, Could we avoid eagerly calling
getSchema / getTableConstraints on every bundle when it isn't needed?
Specifically:
- If dynamicDestinations.getSideInputs().isEmpty(), keeping the lazy
suppliers preserves prior behavior (avoiding per-bundle JSON parsing or user
RPCs / exceptions on pre-existing tables under default CREATE_IF_NEEDED).
- Even when side inputs are present, checking whether CreateTableHelpers
already has tableSpec in createdTables would avoid repeated per-bundle
resolution once a table has been created on this worker.
--
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]