// Named-path assembly (MATCH p = ...): after the pattern binds, each row's // path value is reconstructed from its start node and the hop's bound // relationship position(s); the matchSink then runs the stage WHERE as a // post-path filter so predicates over nodes(p)/rels(p)/length(p) resolve.
package exec import ( ) // pathRelPositionsOf reads a path hop's bound relationship value: a single // rel (fixed hop) or a list of them (quantified hop). func pathRelPositionsOf( value.Value) []uint32 { if , := .AsRel(); { return []uint32{} } if , := .AsList(); { := make([]uint32, 0, len()) for , := range { if , := .AsRel(); { = append(, ) } } return } return nil } // reconstructPathNodes walks from start through the given relationship // positions -- each physical relationship has one position whichever // endpoint it is walked from, so the matched hop's positions name a valid // walk and each hop resolves O(1) by its endpoints. The result slice is // fresh: it escapes into the row's path value. func reconstructPathNodes( *eval.Ctx, graph.NodeID, []uint32) []graph.NodeID { := make([]graph.NodeID, 0, len()+1) = append(, ) := for , := range { , , := .G.RelEndpoints() if ! { break } var graph.NodeID switch { case : = case : = default: return } = append(, ) = } return }