- Record Components:
name- the bound relation name; must not be blankbase- the relation the first round reads; must not be nullstep- the body computing each round from the previous one; must not be nullstop- when the iteration stops; must not be nulllocation- the source location of this node; never null
- All Implemented Interfaces:
RelNode
ITERATE.
ITERATE name (base, step) <stop> binds name over step
exactly as FixpointNode does: occurrences of name inside
step are RecursiveRefNode leaves, and name is not in scope
in base. What differs is what a round does with the step's output.
FIX adds it to everything derived so far; ITERATE
replaces the relation with it. The relation bound to name in a
round is the whole of the previous round's output, and the result is the last
round's output.
Because nothing accumulates, the step is free of FIX's restrictions: it
may reference name any number of times and through any operator —
aggregation, outer joins and difference included — which is what numeric
iterations such as PageRank and state machines such as cellular automata need.
The price is that nothing guarantees it stops, so stop() says when it
does (see IterateStop).
The operator materialises a set: each round is
deduplicated, and IterateStop.Stable compares rounds as sets. It never
pushes down to a source.
Surface syntax: ITERATE R (base, step) ROUNDS n,
… UNTIL STABLE MAX n ROUNDS, or
… UNTIL c WITHIN ε PER k MAX n ROUNDS (keyword-only, no glyph).
-
Constructor Summary
ConstructorsConstructorDescriptionIterateNode(String name, RelNode base, RelNode step, IterateStop stop) Convenience constructor for tests:SourceLocation.UNKNOWN.IterateNode(String name, RelNode base, RelNode step, IterateStop stop, SourceLocation location) Creates an instance of aIterateNoderecord class. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(RelNodeVisitor<R> visitor) base()Returns the value of thebaserecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.name()Returns the value of thenamerecord component.step()Returns the value of thesteprecord component.stop()Returns the value of thestoprecord component.final StringtoString()Returns a string representation of this record class.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
-
IterateNode
public IterateNode(String name, RelNode base, RelNode step, IterateStop stop, SourceLocation location) Creates an instance of aIterateNoderecord class. -
IterateNode
Convenience constructor for tests:SourceLocation.UNKNOWN.
-
-
Method Details
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
base
Returns the value of thebaserecord component.- Returns:
- the value of the
baserecord component
-
step
Returns the value of thesteprecord component.- Returns:
- the value of the
steprecord component
-
stop
Returns the value of thestoprecord component.- Returns:
- the value of the
stoprecord component
-
location
Returns the value of thelocationrecord component.
-