java.lang.Object
java.lang.Record
com.darkcollective.relix.ast.ShuffleNode
- Record Components:
seed- the optional RNG seed for a reproducible permutation; empty = non-deterministicinput- the relation to permute; must not be nulllocation- the source location of this node; never null
- All Implemented Interfaces:
RelNode
public record ShuffleNode(Optional<Long> seed, RelNode input, SourceLocation location)
extends Record
implements RelNode
Random permutation (SHUFFLE) — returns every row of
input exactly once,
in a uniformly random order. It is the random-ordering sibling of τ
(SORT): where sort imposes a deterministic key order, shuffle imposes a random
one.
Cardinality is unchanged — this is the distinction from SAMPLE n ROWS,
which also returns rows out of input order but changes the row count.
A full permutation requires holding every row, so SHUFFLE is a blocking
operator (Fisher–Yates over the buffered rows) and, like SORT, is rejected over a
provably unbounded input by the plan-time blocking-operator check.
Reproducibility: when seed is present the permutation is
deterministic — identical runs produce the identical order. Without a seed,
fresh randomness is drawn each run, exactly as unseeded SAMPLE does.
Examples:
SHUFFLE (Deck)— a random permutation (non-deterministic)SHUFFLE SEED 42 (Deck)— a reproducible permutation
-
Constructor Summary
ConstructorsConstructorDescriptionShuffleNode(RelNode input) Convenience constructor for tests; usesSourceLocation.UNKNOWNand no seed.ShuffleNode(Optional<Long> seed, RelNode input, SourceLocation location) Creates an instance of aShuffleNoderecord class. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(RelNodeVisitor<R> visitor) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.input()Returns the value of theinputrecord component.location()Returns the value of thelocationrecord component.seed()Returns the value of theseedrecord 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
-
ShuffleNode
Creates an instance of aShuffleNoderecord class. -
ShuffleNode
Convenience constructor for tests; usesSourceLocation.UNKNOWNand no seed.
-
-
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). -
seed
Returns the value of theseedrecord component.- Returns:
- the value of the
seedrecord component
-
input
Returns the value of theinputrecord component.- Returns:
- the value of the
inputrecord component
-
location
Returns the value of thelocationrecord component.
-