Source:
<code>static List<MemoryInfo> toNodeMemoryInfoList(long maxReservedPoolBytes, long maxGeneralPoolBytes, String reservedQuery, Map<String, Map<String, Long>> queries) { Map<Node, NodeReservation> nodeReservations = new HashMap<>(); for (Map.Entry<String, Map<String, Long>> entry : queries.entrySet()) { QueryId queryId = new QueryId(entry.getKey()); Map<String, Long> reservationByNode = entry.getValue(); for (Map.Entry<String, Long> nodeEntry : reservationByNode.entrySet()) { PrestoNode node = new PrestoNode(nodeEntry.getKey(), URI.create("http://localhost"), new NodeVersion("version"), false); long bytes = nodeEntry.getValue(); if (bytes == 0) { continue; } if (reservedQuery.equals(entry.getKey())) { nodeReservations.computeIfAbsent(node, ignored -> new NodeReservation()).getReserved().add(queryId, bytes); } else { nodeReservations.computeIfAbsent(node, ignored -> new NodeReservation()).getGeneral().add(queryId, bytes); } } } ImmutableList.Builder<MemoryInfo> result = ImmutableList.builder(); for (Map.Entry<Node, NodeReservation> entry : nodeReservations.entrySet()) { NodeReservation nodeReservation = entry.getValue(); ImmutableMap.Builder<MemoryPoolId, MemoryPoolInfo> pools = ImmutableMap.builder(); <START> if (nodeReservation.getGeneral().totalReservedBytes > 0) { <END> pools.put( GENERAL_POOL, new MemoryPoolInfo( maxGeneralPoolBytes, nodeReservation.getGeneral().getTotalReservedBytes(), 0, nodeReservation.getGeneral().getReservationByQuery(), ImmutableMap.of())); } if (nodeReservation.getReserved().totalReservedBytes > 0) { pools.put( RESERVED_POOL, new MemoryPoolInfo( maxReservedPoolBytes, nodeReservation.getReserved().getTotalReservedBytes(), 0, nodeReservation.getReserved().getReservationByQuery(), ImmutableMap.of())); } result.add(new MemoryInfo(new DataSize(maxReservedPoolBytes + maxGeneralPoolBytes, BYTE), pools.build())); } return result.build(); }</code><technical_language>getter getTotalReservedBytes()</technical_language>

Target:
static List<MemoryInfo> toNodeMemoryInfoList(long maxReservedPoolBytes, long maxGeneralPoolBytes, String reservedQuery, Map<String, Map<String, Long>> queries) { Map<Node, NodeReservation> nodeReservations = new HashMap<>(); for (Map.Entry<String, Map<String, Long>> entry : queries.entrySet()) { QueryId queryId = new QueryId(entry.getKey()); Map<String, Long> reservationByNode = entry.getValue(); for (Map.Entry<String, Long> nodeEntry : reservationByNode.entrySet()) { PrestoNode node = new PrestoNode(nodeEntry.getKey(), URI.create("http://localhost"), new NodeVersion("version"), false); long bytes = nodeEntry.getValue(); if (bytes == 0) { continue; } if (reservedQuery.equals(entry.getKey())) { nodeReservations.computeIfAbsent(node, ignored -> new NodeReservation()).getReserved().add(queryId, bytes); } else { nodeReservations.computeIfAbsent(node, ignored -> new NodeReservation()).getGeneral().add(queryId, bytes); } } } ImmutableList.Builder<MemoryInfo> result = ImmutableList.builder(); for (Map.Entry<Node, NodeReservation> entry : nodeReservations.entrySet()) { NodeReservation nodeReservation = entry.getValue(); ImmutableMap.Builder<MemoryPoolId, MemoryPoolInfo> pools = ImmutableMap.builder(); if (nodeReservation.getGeneral().getTotalReservedBytes() > 0) { pools.put( GENERAL_POOL, new MemoryPoolInfo( maxGeneralPoolBytes, nodeReservation.getGeneral().getTotalReservedBytes(), 0, nodeReservation.getGeneral().getReservationByQuery(), ImmutableMap.of())); } if (nodeReservation.getReserved().getTotalReservedBytes() > 0) { pools.put( RESERVED_POOL, new MemoryPoolInfo( maxReservedPoolBytes, nodeReservation.getReserved().getTotalReservedBytes(), 0, nodeReservation.getReserved().getReservationByQuery(), ImmutableMap.of())); } result.add(new MemoryInfo(new DataSize(maxReservedPoolBytes + maxGeneralPoolBytes, BYTE), pools.build())); } return result.build(); }