Skip to content

Commit becdeab

Browse files
committed
Fix InMemoryCountStoreImpl.estimateRelationshipCount
1 parent c61a68d commit becdeab

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

compatibility/5.15/storage-engine-adapter/src/main/java17/org/neo4j/gds/compat/_515/InMemoryCountsStoreImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ public long relationshipCount(int startLabelId, int typeId, int endLabelId, Curs
9999

100100
@Override
101101
public long estimateRelationshipCount(int startLabelId, int typeId, int endLabelId, CursorContext cursorContext) {
102-
var type = tokenHolders.relationshipTypeGetName(typeId);
103-
return graphStore.relationshipCount(RelationshipType.of(type));
102+
if (typeId == -1) {
103+
return graphStore.relationshipCount();
104+
} else {
105+
var type = tokenHolders.relationshipTypeGetName(typeId);
106+
return graphStore.relationshipCount(RelationshipType.of(type));
107+
}
104108
}
105109

106110
@Override

compatibility/5.16/storage-engine-adapter/src/main/java17/org/neo4j/gds/compat/_516/InMemoryCountsStoreImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ public long relationshipCount(int startLabelId, int typeId, int endLabelId, Curs
9999

100100
@Override
101101
public long estimateRelationshipCount(int startLabelId, int typeId, int endLabelId, CursorContext cursorContext) {
102-
var type = tokenHolders.relationshipTypeGetName(typeId);
103-
return graphStore.relationshipCount(RelationshipType.of(type));
102+
if (typeId == -1) {
103+
return graphStore.relationshipCount();
104+
} else {
105+
var type = tokenHolders.relationshipTypeGetName(typeId);
106+
return graphStore.relationshipCount(RelationshipType.of(type));
107+
}
104108
}
105109

106110
@Override

0 commit comments

Comments
 (0)