snleee commented on a change in pull request #6622:
URL: https://github.com/apache/incubator-pinot/pull/6622#discussion_r584380164



##########
File path: 
pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMetricName.java
##########
@@ -23,5 +23,20 @@
  */
 public interface PinotMetricName {
 
+  /**
+   * Returns the actual metric name.
+   */
   Object getMetricName();
+
+  /**
+   * Overrides the equals method. This is needed as {@link PinotMetricName} is 
used as the key of the key-value pair
+   * inside the hashmap in MetricsRegistry. Without overriding equals and 
hashCode method, all the existing k-v pairs
+   * stored in hashmap cannot be retrieved by initializing a new key.
+   */
+  boolean equals(Object obj);
+
+  /**
+   * Overrides the hashCode method.
+   */
+  int hashCode();

Review comment:
       I think that you also need to add the documentation here that the same 
fields need to be computed in `hashCode()` to keep the contract.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to