Skip to content

Commit 8029f97

Browse files
committed
Fix hidden compat issue in GraphImportProcess
- DatabaseLayout switched from a class to an interface in 5.1
1 parent bcc59c7 commit 8029f97

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

neo4j-adapter/src/main/java/org/neo4j/gds/compat/GraphDatabaseApiProxy.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.jetbrains.annotations.TestOnly;
2323
import org.neo4j.common.DependencyResolver;
24+
import org.neo4j.configuration.Config;
2425
import org.neo4j.exceptions.KernelException;
2526
import org.neo4j.gds.annotation.ValueClass;
2627
import org.neo4j.graphdb.GraphDatabaseService;
@@ -29,6 +30,7 @@
2930
import org.neo4j.graphdb.Result;
3031
import org.neo4j.graphdb.Transaction;
3132
import org.neo4j.io.layout.DatabaseLayout;
33+
import org.neo4j.io.layout.Neo4jLayout;
3234
import org.neo4j.kernel.GraphDatabaseQueryService;
3335
import org.neo4j.kernel.api.KernelTransaction;
3436
import org.neo4j.kernel.api.procedure.GlobalProcedures;
@@ -105,10 +107,18 @@ public static NamedDatabaseId databaseId(GraphDatabaseService db) {
105107
return cast(db).databaseId();
106108
}
107109

110+
@TestOnly
111+
// DatabaseLayout switched from a class to an interface from 5.0 to 5.1
112+
// It should not be used in code paths run in production. Tests are ok
108113
public static DatabaseLayout databaseLayout(GraphDatabaseService db) {
109114
return cast(db).databaseLayout();
110115
}
111116

117+
public static Neo4jLayout neo4jLayout(GraphDatabaseService db) {
118+
Config configuration = resolveDependency(db, Config.class);
119+
return Neo4jLayout.of(configuration);
120+
}
121+
112122
public static DbmsInfo dbmsInfo(GraphDatabaseService db) {
113123
return cast(db).dbmsInfo();
114124
}

0 commit comments

Comments
 (0)