gemini-code-assist[bot] commented on code in PR #38783:
URL: https://github.com/apache/beam/pull/38783#discussion_r3347773193


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiLoads.java:
##########
@@ -457,6 +469,39 @@ private void addErrorCollections(
     }
   }
 
+  private class AddShardKeyFn<DestinationT2, ElementT2>

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   The `AddShardKeyFn` class is currently declared as a non-static inner class 
(`private class`). In Apache Beam, `DoFn` instances must be serializable to be 
distributed to runner workers. Non-static inner classes maintain an implicit 
reference to their enclosing outer class (`StorageApiLoads`), which can cause 
`SerializationException` at runtime if the outer class is not serializable or 
contains non-serializable fields. Declaring the class as `static` avoids 
capturing the outer class instance and ensures proper serialization.
   
   ```suggestion
     private static class AddShardKeyFn<DestinationT2, ElementT2>
   ```



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