You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/06/19 18:43:49 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #11981: [BEAM-8364] SchemaCoder is not consistent with equals

TheNeuralBit commented on a change in pull request #11981:
URL: https://github.com/apache/beam/pull/11981#discussion_r442993899



##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/SchemaCoder.java
##########
@@ -140,7 +140,14 @@ private void verifyDeterministic(Schema schema)
 
   @Override
   public boolean consistentWithEquals() {
-    return true;
+    // We can't guarantee that the user type T has a good equals method, so we assume the coder is
+    // not consistent with equals (BEAM-8364).
+    return false;
+  }

Review comment:
       My only concern with that is if a user's type doesn't have equals defined they'll just get undefined behavior, and not a useful error message. Could we reasonably detect when a user type doesn't meet that requirement and throw an error (or log a warning and have this function return false)?
   
   I think it's technically possible, my first draft of this PR looked at the typeDescriptor and only returned true when the class had equals defined, but I was concerned it was brittle since we don't know the user-defined equals is actually a good one.




----------------------------------------------------------------
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:
users@infra.apache.org