Skip to content

Commit e9f05a0

Browse files
committed
Don't count relationships by there highest id
On block format stores, the relationship id has a different meaning and is not representative of a "highest possible relationship count". Since we use that value only for logging the import progress, it is ok if we end up being slightly inaccurate, so we can use the number of existing relationship as the upper bound.
1 parent 3e09b91 commit e9f05a0

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

compatibility/5-common/neo4j-kernel-adapter/src/main/java17/org/neo4j/gds/compat/_5x/CommonNeo4jProxyImpl.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -465,21 +465,14 @@ public long getHighestPossibleNodeCount(
465465
public long getHighestPossibleRelationshipCount(
466466
Read read, IdGeneratorFactory idGeneratorFactory
467467
) {
468-
return countByIdGenerator(
469-
idGeneratorFactory,
470-
RecordIdType.RELATIONSHIP,
471-
BlockFormat.INSTANCE.relationshipType,
472-
BlockFormat.INSTANCE.dynamicRelationshipType
473-
);
468+
return read.relationshipsGetCount();
474469
}
475470

476471
private static final class BlockFormat {
477472
private static final BlockFormat INSTANCE = new BlockFormat();
478473

479474
private org.neo4j.internal.id.IdType nodeType = null;
480475
private org.neo4j.internal.id.IdType dynamicNodeType = null;
481-
private org.neo4j.internal.id.IdType relationshipType = null;
482-
private org.neo4j.internal.id.IdType dynamicRelationshipType = null;
483476

484477
BlockFormat() {
485478
try {
@@ -490,8 +483,6 @@ private static final class BlockFormat {
490483
switch (type.name()) {
491484
case "NODE" -> this.nodeType = (org.neo4j.internal.id.IdType) type;
492485
case "DYNAMIC_NODE" -> this.dynamicNodeType = (org.neo4j.internal.id.IdType) type;
493-
case "RELATIONSHIP" -> this.relationshipType = (org.neo4j.internal.id.IdType) type;
494-
case "DYNAMIC_RELATIONSHIP" -> this.dynamicRelationshipType = (org.neo4j.internal.id.IdType) type;
495486
}
496487
}
497488
} catch (ClassNotFoundException | NullPointerException | ClassCastException ignored) {

0 commit comments

Comments
 (0)