You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "Thomas Groh (JIRA)" <ji...@apache.org> on 2018/03/08 01:58:00 UTC

[jira] [Created] (BEAM-3807) SerializableCoder#structuralValue should be more effective for types which don't define an equals method

Thomas Groh created BEAM-3807:
---------------------------------

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


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
(v7.6.3#76005)