craigcondit commented on code in PR #923:
URL: https://github.com/apache/yunikorn-core/pull/923#discussion_r1712226312
##########
pkg/common/resources/resources.go:
##########
@@ -884,6 +909,29 @@ func ComponentWiseMinPermissive(left, right *Resource)
*Resource {
return out
}
+// MergeIfNotPresent Returns a new Resource by merging resource type values
present in right with left
+// only if resource type not present in left.
+// If either Resource passed in is nil the other Resource is returned
+// If a Resource type is missing from one of the Resource, it is considered
empty and the quantity from the other Resource is returned
+func MergeIfNotPresent(left, right *Resource) *Resource {
+ if right == nil && left == nil {
+ return nil
+ }
+ if left == nil {
+ return right.Clone()
+ }
+ if right == nil {
+ return left.Clone()
+ }
+ out := left
Review Comment:
This still needs to be updated. This should never update left, and without a
clone it will.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]