public ResourceSpec merge ( ResourceSpec other ) { ResourceSpec target = new ResourceSpec ( Math . max ( this . cpuCores , other . cpuCores ) , this . heapMemoryInMB + other . heapMemoryInMB , this . directMemoryInMB + other . directMemoryInMB , this . nativeMemoryInMB + other . nativeMemoryInMB , this . stateSizeInMB + other . stateSizeInMB ) ; target . extendedResources . putAll ( extendedResources ) ; for ( Resource resource : other . extendedResources . values ( ) ) { target . extendedResources . merge ( resource . getName ( ) , resource , ( v1 , v2 ) -> v1 . merge ( v2 ) ) ; } return target ; }
Used by system internally to merge the other resources of chained operators when generating the job graph or merge the resource consumed by state backend .