[ 
https://issues.apache.org/jira/browse/BEAM-3807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17546891#comment-17546891
 ] 

Kenneth Knowles commented on BEAM-3807:
---------------------------------------

This issue has been migrated to https://github.com/apache/beam/issues/18703

> SerializableCoder#structuralValue should be more effective for types which 
> don't define an equals method
> --------------------------------------------------------------------------------------------------------
>
>                 Key: BEAM-3807
>                 URL: https://issues.apache.org/jira/browse/BEAM-3807
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Thomas Groh
>            Priority: P3
>              Labels: Clarified
>
> Specifically, types which don't implement an equals method (or more loosely, 
> types which use the Object equals method) should either implement 
> {{#structuralValue}} via using encoded bytes, or require the use of an 
> {{Equivalence}} (like the guava definition).
>  
> It should always be that the following snippet (or its approximation) returns 
> {{true}}:
> {{<T> expected(Coder<T> myCoder, }}{{T myElement)}}
> {{byte[] elementBytes = CoderUtils.serializeToByteArray(myCoder, myElement);}}
> {{T decodedFirst = CoderUtils.deserializeFromByteArray(myCoder, 
> elementBytes);}}
> {{T decodedSecond = CoderUtils.deserializeFromByteArray(myCoder, 
> elementBytes);}}
> {{myCoder.structuralValue(decodedFirst).equals(myCoder.structuralValue(decodedScond));}}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to