zhuzhurk 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_r342958883
 
 

 ##########
 File path: 
flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
 ##########
 @@ -145,13 +148,15 @@ private ResourceSpec() {
         * @param other Reference to resource to merge in.
         * @return The new resource with merged values.
         */
-       public ResourceSpec merge(ResourceSpec other) {
+       public ResourceSpec merge(final ResourceSpec other) {
+               checkNotNull(other, "Cannot merge with null resources");
+
                if (this.equals(UNKNOWN) || other.equals(UNKNOWN)) {
                        return UNKNOWN;
                }
 
                ResourceSpec target = new ResourceSpec(
-                               this.cpuCores + other.cpuCores,
+                               this.cpuCores.merge(other.cpuCores).getValue(),
 
 Review comment:
   It's for backward compatibility. But I think you are right we can change the 
constructor to directly accept ResourceValue. The change is made in 
9627a892cd7076abf01174376dbcdfc9baf41c13.

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


With regards,
Apache Git Services

Reply via email to