Skip to content

Commit

Permalink
[fix](statistics)Fix update rows bug. (apache#39368)
Browse files Browse the repository at this point in the history
Fix update rows bug. Need to new a hashmap to store the tablet id to row
count entry. Otherwise the row count is not accurate.
  • Loading branch information
Jibing-Li authored Aug 15, 2024
1 parent 9c21e11 commit 7caddd0
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,12 @@ private void calculateTaskUpdateRows(Map<Long, Map<Long, Long>> tableIdToTabletD
LOG.info("Task backend id {}, update rows info : [{}]",
task.getBackendId(), task.getTableIdToTabletDeltaRows());
for (Entry<Long, Map<Long, Long>> tableEntry : task.getTableIdToTabletDeltaRows().entrySet()) {
if (tableIdToTabletDeltaRows.containsKey(tableEntry.getKey())) {
Map<Long, Long> tabletsDelta = tableIdToTabletDeltaRows.get(tableEntry.getKey());
for (Entry<Long, Long> tabletEntry : tableEntry.getValue().entrySet()) {
tabletsDelta.computeIfPresent(tabletEntry.getKey(),
(tabletId, origRows) -> origRows + tabletEntry.getValue());
tabletsDelta.putIfAbsent(tabletEntry.getKey(), tabletEntry.getValue());
}
} else {
tableIdToTabletDeltaRows.put(tableEntry.getKey(), tableEntry.getValue());
tableIdToTabletDeltaRows.putIfAbsent(tableEntry.getKey(), Maps.newHashMap());
Map<Long, Long> tabletsDelta = tableIdToTabletDeltaRows.get(tableEntry.getKey());
for (Entry<Long, Long> tabletEntry : tableEntry.getValue().entrySet()) {
tabletsDelta.computeIfPresent(tabletEntry.getKey(),
(tabletId, origRows) -> origRows + tabletEntry.getValue());
tabletsDelta.putIfAbsent(tabletEntry.getKey(), tabletEntry.getValue());
}
}
}
Expand Down

0 comments on commit 7caddd0

Please sign in to comment.