kennknowles commented on a change in pull request #13225:
URL: https://github.com/apache/beam/pull/13225#discussion_r514607907
##########
File path:
runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/SdkComponents.java
##########
@@ -264,10 +264,18 @@ public String registerCoder(Coder<?> coder) throws
IOException {
if (existing != null) {
return existing;
}
+ // Unlike StructuredCoder, custom coders may not have proper
implementation of hashCode() and
+ // equals(), this lead to unnecessary duplications. In order to avoid this
we examine already
+ // registered coders and see if we can find a matching proto, and consider
them same coder.
+ RunnerApi.Coder coderProto = CoderTranslation.toProto(coder, this);
+ for (Map.Entry<String, RunnerApi.Coder> entry :
componentsBuilder.getCodersMap().entrySet()) {
Review comment:
Keep an additional `Map<RunnerApi.Coder, String> coderProtoToId` for
this? The objects in the map should be shared by reference so very little
overhead.
----------------------------------------------------------------
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:
[email protected]