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_r342950891
 
 

 ##########
 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:
   >> BTW, it seems that the precision will always set to the default, why not 
change it to a constant.
   
   Different precisions are support to support different extended resources in 
the future. Since there is no contract of the precision, each resource can 
decide it by themselves if needed.

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