SQL graph algorithms (shortestPath, dijkstra, bellmanFord, astar): adopt FunctionOptions for trailing options (original) (raw)
Motivation
Follow-up to #3879 (vector.neighbors options map) and #3880 (fulltext.* options map). The four SQL graph path-finding functions have inconsistent option handling:
shortestPath(src, dest [, direction [, edgeType [, {maxDepth, edge}]]])- mixed positional + map, map only covers two knobs.dijkstra(src, dest, weight [, direction])- single positional, primed for growth (edgeTypeNames, maxDepth, etc.).bellmanFord(src, dest, weight [, direction])- same as dijkstra, plus a foreseeabledetectNegativeCyclesflag.astar(src, dest, weight [, {options}])- already fully map-driven, but uses hand-rolled parsing that silently ignores unknown keys.
Proposal
- Route all four through
com.arcadedb.function.sql.FunctionOptionsso unknown keys throw a descriptive error and type coercion is consistent withvector.neighborsandfulltext.*. - Let
shortestPath,dijkstra,bellmanFordaccept an options map that consolidatesdirection,edgeTypeNames,maxDepth,emptyIfMaxDepth, and (for shortestPath)edge. Existing positional forms stay for backward compatibility. astarkeeps the same surface but swaps its bespoke parser forFunctionOptions, keeping the same accepted keys (direction,edgeTypeNames,vertexAxisNames,parallel,maxDepth,emptyIfMaxDepth,tieBreaker,dFactor,heuristicFormula,customHeuristicFormula).
Non-goals
- No grammar changes.
- No renames: these functions already use camelCase under the convention.
Deliverables
- Code: refactor the four functions through
FunctionOptions. - Tests: options-map form + unknown-key rejection.
- Docs: show options-map syntax alongside positional for each function.