Skip to content

Commit 71ed216

Browse files
soerenreichardts1ck
andcommitted
Avoid creation of Nodes without node schema
Co-authored-by: Martin Junghanns <martin.junghanns@neotechnology.com>
1 parent c6cffbc commit 71ed216

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

core/src/main/java/org/neo4j/gds/core/loading/CSRGraphStoreUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static CSRGraphStore createFromGraph(
104104
// TODO: is it correct that we only use this for generated graphs?
105105
.capabilities(ImmutableStaticCapabilities.of(false))
106106
.schema(schema)
107-
.nodes(Nodes.of(graph.idMap(), nodeProperties))
107+
.nodes(ImmutableNodes.of(schema.nodeSchema(), graph.idMap(), nodeProperties))
108108
.relationshipImportResult(relationshipImportResult)
109109
.graphProperties(GraphPropertyStore.empty())
110110
.concurrency(concurrency)

core/src/main/java/org/neo4j/gds/core/loading/Nodes.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.neo4j.gds.core.loading;
2121

2222
import org.immutables.value.Value;
23+
import org.jetbrains.annotations.TestOnly;
2324
import org.neo4j.gds.NodeLabel;
2425
import org.neo4j.gds.PropertyMapping;
2526
import org.neo4j.gds.PropertyMappings;
@@ -50,14 +51,11 @@ default NodePropertyStore properties() {
5051
return NodePropertyStore.empty();
5152
}
5253

54+
@TestOnly
5355
static Nodes of(IdMap idmap) {
5456
return ImmutableNodes.of(NodeSchema.empty(), idmap, NodePropertyStore.empty());
5557
}
5658

57-
static Nodes of(IdMap idmap, NodePropertyStore nodePropertyStore) {
58-
return ImmutableNodes.of(NodeSchema.empty(), idmap, nodePropertyStore);
59-
}
60-
6159
static Nodes of(
6260
IdMap idMap,
6361
Map<NodeLabel, PropertyMappings> propertyMappingsByLabel,

graph-sampling/src/main/java/org/neo4j/gds/graphsampling/GraphSampleConstructor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import org.neo4j.gds.core.concurrency.Pools;
3434
import org.neo4j.gds.core.concurrency.RunWithConcurrency;
3535
import org.neo4j.gds.core.loading.GraphStoreBuilder;
36-
import org.neo4j.gds.core.loading.Nodes;
36+
import org.neo4j.gds.core.loading.ImmutableNodes;
3737
import org.neo4j.gds.core.loading.RelationshipImportResult;
3838
import org.neo4j.gds.core.loading.construction.GraphFactory;
3939
import org.neo4j.gds.core.loading.construction.NodeLabelTokens;
@@ -124,7 +124,7 @@ public double evaluate(EvaluationContext context) {
124124
.databaseId(inputGraphStore.databaseId())
125125
.capabilities(inputGraphStore.capabilities())
126126
.schema(filteredSchema)
127-
.nodes(Nodes.of(idMap, nodePropertyStore))
127+
.nodes(ImmutableNodes.of(filteredSchema.nodeSchema(), idMap, nodePropertyStore))
128128
.relationshipImportResult(relationshipImportResult)
129129
.concurrency(config.concurrency())
130130
.build();

subgraph-filtering/src/main/java/org/neo4j/gds/beta/filter/GraphStoreFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.neo4j.gds.beta.filter.expression.ValidationContext;
3535
import org.neo4j.gds.config.GraphProjectFromGraphConfig;
3636
import org.neo4j.gds.core.loading.GraphStoreBuilder;
37-
import org.neo4j.gds.core.loading.Nodes;
37+
import org.neo4j.gds.core.loading.ImmutableNodes;
3838
import org.neo4j.gds.core.loading.RelationshipImportResult;
3939
import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker;
4040
import org.neo4j.gds.core.utils.progress.tasks.Task;
@@ -121,7 +121,7 @@ public static GraphStore filter(
121121
.databaseId(graphStore.databaseId())
122122
.capabilities(graphStore.capabilities())
123123
.schema(filteredSchema)
124-
.nodes(Nodes.of(filteredNodes.idMap(), filteredNodes.propertyStores()))
124+
.nodes(ImmutableNodes.of(filteredSchema.nodeSchema(), filteredNodes.idMap(), filteredNodes.propertyStores()))
125125
.relationshipImportResult(RelationshipImportResult.of(filteredRelationships))
126126
.concurrency(config.concurrency())
127127
.build();

0 commit comments

Comments
 (0)