zentol commented on a change in pull request #10079: [FLINK-14594] Fix matching 
logics of ResourceSpec/ResourceProfile/Resource considering double values
URL: https://github.com/apache/flink/pull/10079#discussion_r346788946
 
 

 ##########
 File path: 
flink-core/src/main/java/org/apache/flink/api/common/resources/Resource.java
 ##########
 @@ -116,29 +80,32 @@ public boolean equals(Object o) {
        @Override
        public int hashCode() {
                int result = name.hashCode();
-               result = 31 * result + resourceAggregateType.ordinal();
-               result = 31 * result + (int) value;
+               result = 31 * result + value.hashCode();
                return result;
        }
 
+       @Override
+       public String toString() {
+               return String.format("Resource(%s: %s)", name, value);
+       }
+
        public String getName() {
                return name;
        }
 
-       public ResourceAggregateType getResourceAggregateType() {
-               return resourceAggregateType;
+       public BigDecimal getValue() {
+               return value;
        }
 
-       public double getValue() {
-               return value;
+       public double getDoubleValue() {
 
 Review comment:
   do we expect usages of this method outside of tests? Exposing the value as a 
double this easily could likely result in subtle bugs, similar to the issues 
that this PR is trying to prevent.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to