From 983334f674bf6800c6a5a4bcdb909445f208273a Mon Sep 17 00:00:00 2001 From: Martin Junghanns Date: Wed, 25 Sep 2024 11:08:48 +0200 Subject: [PATCH] Use UNKNOWN intermediate id in high limit case The assumption was that this fails with high limit as the label information builder needs to be sized. However, the label information builder uses a growing bit set, which is - as the name suggests - growing. --- .../gds/core/loading/construction/GraphFactory.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/neo4j/gds/core/loading/construction/GraphFactory.java b/core/src/main/java/org/neo4j/gds/core/loading/construction/GraphFactory.java index 26d70b145c..27e9468a95 100644 --- a/core/src/main/java/org/neo4j/gds/core/loading/construction/GraphFactory.java +++ b/core/src/main/java/org/neo4j/gds/core/loading/construction/GraphFactory.java @@ -119,11 +119,10 @@ static NodesBuilder nodesBuilder( // If the requested id map is high limit, we need to make sure that // internal data structures are sized accordingly. Using the highest // original id will potentially fail due to size limitations. - if (nodeCount.isPresent()) { - maxIntermediateId = nodeCount.get() - 1; - } else { - throw new IllegalArgumentException("Cannot use high limit id map without node count."); - } + // If the node count is not given, we fall back to an unknown max id, + // which is fine since label building relies on growing bitsets. + maxIntermediateId = nodeCount.map(nc -> nc - 1).orElse(NodesBuilder.UNKNOWN_MAX_ID); + if (deduplicate) { // We internally use HABS for deduplication, which is being initialized // with max original id. This is fine for all id maps except high limit,