Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-3807

SerializableCoder#structuralValue should be more effective for types which don't define an equals method

Details

    • Bug
    • Status: Open
    • P3
    • Resolution: Unresolved
    • None
    • None
    • sdk-java-core

    Description

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            tgroh Thomas Groh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: