Skip to content

Commit 0bc8322

Browse files
FlorentinDMats-SX
authored andcommitted
Implement visitAllCounts
1 parent 6413880 commit 0bc8322

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

compatibility/5.15/storage-engine-adapter/src/main/java17/org/neo4j/internal/recordstorage/InMemoryStorageReader515.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import org.neo4j.common.TokenNameLookup;
2525
import org.neo4j.counts.CountsStore;
2626
import org.neo4j.counts.CountsVisitor;
27+
import org.neo4j.gds.NodeLabel;
28+
import org.neo4j.gds.RelationshipType;
2729
import org.neo4j.gds.compat._515.InMemoryNodeCursor;
2830
import org.neo4j.gds.compat._515.InMemoryPropertyCursor;
2931
import org.neo4j.gds.compat._515.InMemoryRelationshipScanCursor;
@@ -340,4 +342,22 @@ public TokenNameLookup tokenNameLookup() {
340342
return tokenHolders;
341343
}
342344

345+
@Override
346+
public void visitAllCounts(CountsVisitor countsVisitor, CursorContext cursorContext) {
347+
for (NodeLabel label : graphStore.nodeLabels()) {
348+
var tokenHolder = tokenHolders.labelTokens();
349+
countsVisitor.visitNodeCount(tokenHolder.getIdByName(label.name()), graphStore.nodes().nodeCount(label));
350+
}
351+
352+
for (RelationshipType relationshipType : graphStore.relationshipTypes()) {
353+
var tokenHolder = tokenHolders.relationshipTypeTokens();
354+
// we dont know start / end label for a reltype
355+
countsVisitor.visitRelationshipCount(
356+
-1,
357+
tokenHolder.getIdByName(relationshipType.name()),
358+
-1,
359+
graphStore.relationshipCount(relationshipType)
360+
);
361+
}
362+
}
343363
}

0 commit comments

Comments
 (0)