Skip to content

Commit 6e146fd

Browse files
Fix bug with lost projected relationship type name
Co-Authored-By: Paul Horn <paul.horn@neotechnology.com>
1 parent e986d4f commit 6e146fd

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

core/src/main/java/org/neo4j/graphalgo/RelationshipProjectionMapping.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ static RelationshipProjectionMapping all() {
3333
}
3434

3535
static RelationshipProjectionMapping all(Orientation orientation) {
36+
return all("", orientation);
37+
}
38+
39+
static RelationshipProjectionMapping all(String projectedType, Orientation orientation) {
3640
return ImmutableRelationshipProjectionMapping.builder()
3741
.typeName("")
38-
.relationshipType(RelationshipType.of(""))
42+
.relationshipType(RelationshipType.of(projectedType))
3943
.orientation(orientation)
4044
.typeId(ANY_RELATIONSHIP_TYPE)
4145
.exists(true)

core/src/main/java/org/neo4j/graphalgo/core/GraphDimensionsReader.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ public GraphDimensions apply(KernelTransaction transaction) throws RuntimeExcept
8989
Orientation orientation = relationshipProjection.orientation();
9090

9191
RelationshipProjectionMapping mapping = relationshipProjection.projectAll()
92-
? RelationshipProjectionMapping.all(orientation)
92+
? RelationshipType.ALL_RELATIONSHIPS.equals(relationshipType)
93+
? RelationshipProjectionMapping.all(orientation)
94+
: RelationshipProjectionMapping.all(relationshipType.name(), orientation)
9395
: RelationshipProjectionMapping.of(
9496
relationshipType,
9597
typeName,

proc/catalog/src/test/java/org/neo4j/graphalgo/catalog/GraphCreateProcTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ void tearDown() {
133133
GraphStoreCatalog.removeAllLoadedGraphs();
134134
}
135135

136+
@Test
137+
void shouldLoadNamedAllRelationshipsProjection() {
138+
String createQuery = "CALL gds.graph.create('test', '*', {test: {type: '*'}})";
139+
runQuery(createQuery);
140+
String algoQuery = "CALL gds.testProc.test('test', {relationshipTypes: ['test'], writeProperty: 'foo'})";
141+
// Test that the query doesn't throw an exception
142+
runQuery(algoQuery);
143+
}
144+
136145
@Test
137146
void failWhenNotFindingGraph() {
138147
String query1 = "CALL gds.testProc.test('nope', {writeProperty: 'p'})";

0 commit comments

Comments
 (0)