arcadedb
arcadedb copied to clipboard
SQL: "dijkstra" function does not accept documented arguments
ArcadeDB Version 25.2.1-SNAPSHOT
The dijkstra function does not work as described, for example (SQLscript):
CREATE VERTEX TYPE V;
CREATE EDGE TYPE E;
CREATE PROPERTY E.distance LONG;
LET $src = (INSERT INTO V);
LET $dst = (INSERT INTO V);
CREATE EDGE E FROM $src TO $dst SET distance = 1;
CREATE EDGE E FROM $src TO $dst SET distance = 10;
LET $src = (SELECT FROM V LIMIT 1);
LET $dst = (SELECT FROM V LIMIT 1 SKIP 1);
SELECT dijkstra($src, $dst, 'distance') FROM V;
results in the error:
Error on command execution (PostCommandHandler): class com.arcadedb.graph.ImmutableVertex cannot be cast to class java.lang.String (com.arcadedb.graph.ImmutableVertex is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
Similarly, using instead:
LET $src = (SELECT FROM V LIMIT 1);
LET $dst = (SELECT FROM V LIMIT 1 SKIP 1);
SELECT dijkstra($src.@rid, $dst.@rid, 'distance') FROM V;
results in the error:
Error on command execution (PostCommandHandler): class com.arcadedb.database.RID cannot be cast to class java.lang.String (com.arcadedb.database.RID is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
So it seems the source and destination arguments for the dijkstra function are not parsed correctly.
It seems the astar SQL function has the same / a similar problem. Note, dijkstra calls astar, see https://github.com/ArcadeData/arcadedb/blob/main/engine/src/main/java/com/arcadedb/query/sql/function/graph/SQLFunctionDijkstra.java#L48