- Record Components:
input- the edge relation; must not be nullfromColumn- the source-endpoint column; also names the output source column; must not be blanktoColumn- the target-endpoint column; must not be blankundirected-truereads the two endpoint columns as an undirected edge, so the relation is followed both ways from one edge set (a ↔ b);falsereads a directed edge (a, b)minHops- the inclusive lower bound of the hop window; must be>= 1maxHops- the inclusive upper bound of the hop window; must be>= minHopsdepthColumn- the name of the appended hop-distance column; must not be blankboundSource- optional literal bound on thefromColumnendpoint (single-source); never null, possibly emptyboundTarget- optional literal bound on thetoColumnendpoint (single-target); never null, possibly emptylocation- the source location of this node; never null
- All Implemented Interfaces:
RelNode
The input() relation is read as a set of directed edges over
two columns, fromColumn() and toColumn(). The operator emits one
row (a, b, d) for every pair connected by a directed path whose length
d lies within the inclusive hop window [minHops, maxHops], where
d is the shortest such length. It is therefore the bounded sibling
of ClosureNode (unbounded transitive closure) that also reports the hop
distance — the "everything within N hops" traversal investigators and analysts
need, which SQL expresses only with a WITH RECURSIVE CTE plus a depth guard.
The start node is not baked into the operator: scope a traversal to a
particular origin by composing an ordinary σ on the output (RA-native), e.g.
σ from = 1001 (PATH …).
Output is a ternary relation: the source-endpoint column (keeping the
fromColumn() name and type), the target-endpoint column (keeping the
toColumn() name and type), and the hop-distance column
(depthColumn(), type NUMBER). Because d is the minimal
length, (from, to) is a candidate key of the result (no pair appears at two
depths).
Evaluation is an in-engine bounded breadth-first traversal over the whole edge set — a blocking operator (it must see every edge), so it never pushes down to a source and is subject to the boundedness check over unbounded inputs. Null endpoints are skipped; cyclic graphs terminate because the window caps the path length.
Surface syntax: PATH from, to HOPS m..n AS depth (Edges).
-
Constructor Summary
ConstructorsConstructorDescriptionPathNode(RelNode input, String fromColumn, String toColumn, boolean undirected, int minHops, int maxHops, String depthColumn, SourceLocation location) Constructor without endpoint bounds (the parsed form): both bounds empty.PathNode(RelNode input, String fromColumn, String toColumn, boolean undirected, int minHops, int maxHops, String depthColumn, Optional<Operand> boundSource, Optional<Operand> boundTarget, SourceLocation location) Creates an instance of aPathNoderecord class.PathNode(RelNode input, String fromColumn, String toColumn, int minHops, int maxHops, String depthColumn) Convenience constructor for tests:SourceLocation.UNKNOWN. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(RelNodeVisitor<R> visitor) Returns the value of theboundSourcerecord component.Returns the value of theboundTargetrecord component.Returns the value of thedepthColumnrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefromColumnrecord component.final inthashCode()Returns a hash code value for this object.input()Returns the value of theinputrecord component.location()Returns the value of thelocationrecord component.intmaxHops()Returns the value of themaxHopsrecord component.intminHops()Returns the value of theminHopsrecord component.toColumn()Returns the value of thetoColumnrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theundirectedrecord component.withBounds(Optional<Operand> newSource, Optional<Operand> newTarget) Returns a copy of this path with the given endpoint bounds, preserving all other fields.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.darkcollective.relix.ast.RelNode
children, mapChildren, materializationMode, prettyPrint
-
Constructor Details
-
PathNode
public PathNode(RelNode input, String fromColumn, String toColumn, boolean undirected, int minHops, int maxHops, String depthColumn, Optional<Operand> boundSource, Optional<Operand> boundTarget, SourceLocation location) Creates an instance of aPathNoderecord class.- Parameters:
input- the value for theinputrecord componentfromColumn- the value for thefromColumnrecord componenttoColumn- the value for thetoColumnrecord componentundirected- the value for theundirectedrecord componentminHops- the value for theminHopsrecord componentmaxHops- the value for themaxHopsrecord componentdepthColumn- the value for thedepthColumnrecord componentboundSource- the value for theboundSourcerecord componentboundTarget- the value for theboundTargetrecord componentlocation- the value for thelocationrecord component
-
PathNode
public PathNode(RelNode input, String fromColumn, String toColumn, boolean undirected, int minHops, int maxHops, String depthColumn, SourceLocation location) Constructor without endpoint bounds (the parsed form): both bounds empty.- Parameters:
input- the edge relation; must not be nullfromColumn- the source-endpoint column; must not be blanktoColumn- the target-endpoint column; must not be blankundirected-trueto read the edges both waysminHops- the inclusive lower bound of the hop windowmaxHops- the inclusive upper bound of the hop windowdepthColumn- the name of the appended hop-distance columnlocation- the source location of this node; never null
-
PathNode
public PathNode(RelNode input, String fromColumn, String toColumn, int minHops, int maxHops, String depthColumn) Convenience constructor for tests:SourceLocation.UNKNOWN.
-
-
Method Details
-
withBounds
Returns a copy of this path with the given endpoint bounds, preserving all other fields.- Parameters:
newSource- the source-endpoint bound; must not be nullnewTarget- the target-endpoint bound; must not be null- Returns:
- a bounded copy
-
accept
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
input
Returns the value of theinputrecord component.- Returns:
- the value of the
inputrecord component
-
fromColumn
Returns the value of thefromColumnrecord component.- Returns:
- the value of the
fromColumnrecord component
-
toColumn
Returns the value of thetoColumnrecord component.- Returns:
- the value of the
toColumnrecord component
-
undirected
public boolean undirected()Returns the value of theundirectedrecord component.- Returns:
- the value of the
undirectedrecord component
-
minHops
public int minHops()Returns the value of theminHopsrecord component.- Returns:
- the value of the
minHopsrecord component
-
maxHops
public int maxHops()Returns the value of themaxHopsrecord component.- Returns:
- the value of the
maxHopsrecord component
-
depthColumn
Returns the value of thedepthColumnrecord component.- Returns:
- the value of the
depthColumnrecord component
-
boundSource
Returns the value of theboundSourcerecord component.- Returns:
- the value of the
boundSourcerecord component
-
boundTarget
Returns the value of theboundTargetrecord component.- Returns:
- the value of the
boundTargetrecord component
-
location
Returns the value of thelocationrecord component.
-