Skip to content

Commit db884d8

Browse files
Add rel type to schema without properties present
1 parent 1392dc6 commit db884d8

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cypher-aggregation/src/main/java/org/neo4j/gds/projection/CypherAggregation.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,16 +641,18 @@ private void buildRelationshipsWithProperties(
641641
Optional.empty()
642642
);
643643

644-
var topology = allRelationships.get(0).relationships().topology();
644+
var firstRelationshipsAndDirection = allRelationships.get(0);
645+
var topology = firstRelationshipsAndDirection.relationships().topology();
646+
var direction = firstRelationshipsAndDirection.direction();
645647

646648
var propertyStore = CSRGraphStoreUtil.buildRelationshipPropertyStore(
647649
allRelationships,
648650
Objects.requireNonNullElse(this.relationshipPropertySchemas, List.of())
649651
);
650652

653+
var relationshipSchemaEntry = relationshipSchema.getOrCreateRelationshipType(relationshipType, direction);
651654
propertyStore.relationshipProperties().forEach((propertyKey, relationshipProperties) -> {
652-
relationshipSchema
653-
.getOrCreateRelationshipType(relationshipType, Direction.DIRECTED)
655+
relationshipSchemaEntry
654656
.addProperty(
655657
propertyKey,
656658
relationshipProperties.propertySchema()

proc/catalog/src/test/java/org/neo4j/gds/catalog/GraphListProcTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.junit.jupiter.params.provider.ValueSource;
3232
import org.neo4j.gds.BaseProcTest;
3333
import org.neo4j.gds.api.DatabaseId;
34+
import org.neo4j.gds.api.schema.Direction;
3435
import org.neo4j.gds.beta.generator.GraphGenerateProc;
3536
import org.neo4j.gds.config.GraphProjectConfig;
3637
import org.neo4j.gds.core.loading.GraphStoreCatalog;
@@ -403,12 +404,12 @@ void listCypherAggregation() {
403404
"database", "neo4j",
404405
"schema", map(
405406
"nodes", map(ALL_NODES.name, map()),
406-
"relationships", map(),
407+
"relationships", map(ALL_RELATIONSHIPS.name, map()),
407408
"graphProperties", map()
408409
),
409410
"schemaWithOrientation", map(
410411
"nodes", map(ALL_NODES.name, map()),
411-
"relationships", map(),
412+
"relationships", map(ALL_RELATIONSHIPS.name, map("properties", map(), "direction", Direction.DIRECTED.toString())),
412413
"graphProperties", map()
413414
),
414415
"configuration", new Condition<>(config -> {

0 commit comments

Comments
 (0)