presto-main/src/main/java/io/prestosql/memory/ClusterMemoryPool.java/ClusterMemoryPool/mergeQueryAllocations
class ClusterMemoryPool:    private List<MemoryAllocation> mergeQueryAllocations(List<MemoryAllocation> left, List<MemoryAllocation> right)
    {
        requireNonNull(left, "left is null");
        requireNonNull(right, "right is null");

        Map<String, MemoryAllocation> mergedAllocations = new HashMap<>();

        for (MemoryAllocation allocation : left) {
            mergedAllocations.put(allocation.getTag(), allocation);
        }

        for (MemoryAllocation allocation : right) {
            mergedAllocations.merge(
                    allocation.getTag(),
                    allocation,
                    (a, b) -> new MemoryAllocation(a.getTag(), a.getAllocation() + b.getAllocation()));
        }

        return new ArrayList<>(mergedAllocations.values());
    }