[GitHub] benlamonica commented on a change in pull request #6610: [FLINK-10204] - fix serialization/copy error for LatencyMarker records.
benlamonica commented on a change in pull request #6610: [FLINK-10204] - fix serialization/copy error for LatencyMarker records. URL: https://github.com/apache/flink/pull/6610#discussion_r212623923 ## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/LatencyMarker.java ## @@ -67,31 +67,40 @@ public int getSubtaskIndex() { // @Override - public boolean equals(Object o) { - if (this == o) { + public boolean equals(Object obj) { Review comment: Yes, the prior implementation did this: `if (operatorId != that.operatorId) {` instead of calling equals(), which resulted in a false if the object is equivalent, but not the exact same object (for example, when the bytestream is copied). These changes are just from eclipse generating the equals and hashCode methods. I needed to do this so that the unit test would actually pass since it uses the equals method in it's assertion. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] benlamonica commented on a change in pull request #6610: [FLINK-10204] - fix serialization/copy error for LatencyMarker records.
benlamonica commented on a change in pull request #6610: [FLINK-10204] - fix serialization/copy error for LatencyMarker records. URL: https://github.com/apache/flink/pull/6610#discussion_r212626021 ## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/LatencyMarker.java ## @@ -67,31 +67,40 @@ public int getSubtaskIndex() { // @Override - public boolean equals(Object o) { - if (this == o) { + public boolean equals(Object obj) { + if (this == obj) { return true; } - if (o == null || getClass() != o.getClass()){ + if (obj == null) { return false; } - - LatencyMarker that = (LatencyMarker) o; - - if (markedTime != that.markedTime) { + if (getClass() != obj.getClass()) { return false; } - if (operatorId != that.operatorId) { + LatencyMarker other = (LatencyMarker) obj; + if (markedTime != other.markedTime) { return false; } - return subtaskIndex == that.subtaskIndex; - + if (operatorId == null) { + if (other.operatorId != null) { + return false; + } + } else if (!operatorId.equals(other.operatorId)) { + return false; + } + if (subtaskIndex != other.subtaskIndex) { + return false; + } + return true; } @Override public int hashCode() { - int result = (int) (markedTime ^ (markedTime >>> 32)); Review comment: This is just the way eclipse generates the hashCode. Since operatorId can be null, it does a nullcheck before calling hashCode on it. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] benlamonica commented on a change in pull request #6610: [FLINK-10204] - fix serialization/copy error for LatencyMarker records.
benlamonica commented on a change in pull request #6610: [FLINK-10204] - fix serialization/copy error for LatencyMarker records. URL: https://github.com/apache/flink/pull/6610#discussion_r212639070 ## File path: flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/streamrecord/StreamElementSerializerTest.java ## @@ -89,6 +90,9 @@ public void testSerialization() throws Exception { Watermark negativeWatermark = new Watermark(-4647654567676555876L); assertEquals(negativeWatermark, serializeAndDeserialize(negativeWatermark, serializer)); + + LatencyMarker latencyMarker = new LatencyMarker(System.currentTimeMillis(), new OperatorID(-1, -1), 1); + assertEquals(latencyMarker, serializeAndDeserialize(latencyMarker, serializer)); Review comment: hashCode and equals changes are to support this line here. Without it, even though the objects have the same values, they still evaluate as not equal. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] benlamonica commented on a change in pull request #6610: [FLINK-10204] - fix serialization/copy error for LatencyMarker records.
benlamonica commented on a change in pull request #6610: [FLINK-10204] - fix serialization/copy error for LatencyMarker records. URL: https://github.com/apache/flink/pull/6610#discussion_r212666184 ## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/LatencyMarker.java ## @@ -67,31 +67,40 @@ public int getSubtaskIndex() { // @Override - public boolean equals(Object o) { - if (this == o) { + public boolean equals(Object obj) { + if (this == obj) { return true; } - if (o == null || getClass() != o.getClass()){ + if (obj == null) { return false; } - - LatencyMarker that = (LatencyMarker) o; - - if (markedTime != that.markedTime) { + if (getClass() != obj.getClass()) { return false; } - if (operatorId != that.operatorId) { Review comment: Sure, I will do that. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services