- Record Components:
left- the left (probe) relation; must not be nullright- the right (lookup) relation; must not be nullcondition- the match condition (equality keys + one ordering inequality); must not be nulltolerance- optional WITHIN clause — a DURATION bound on the match distanceinner- whentrue, unmatched probes are dropped (inner variant); whenfalse(default), they are emitted with NULL right columnstieBreak- how to break ties among right rows at the same nearest-match valuelocation- the source location of this node; never null
- All Implemented Interfaces:
RelNode
ASOF) — a temporal "pick the nearest right row by time"
join.
For each left (probe) row, among the right rows that agree on the
equality conjuncts of condition (the partition keys) and
satisfy its single ordering inequality (the match column), the join
emits the probe concatenated with the single nearest such right row.
The inequality operator fixes the direction:
ℓ.ts >= r.ts/ℓ.ts > r.ts— backward: the greatestr.tsat-or-before (or strictly before) the probe.ℓ.ts <= r.ts/ℓ.ts < r.ts— forward: the leastr.tsat-or-after (or strictly after) the probe.
By default the join is left-outer: every probe survives, with the
right columns NULL when no right row matches. Setting inner to
true switches to the inner variant, which drops unmatched
probes.
An optional tolerance (a WITHIN durExpr clause) imposes a
maximum temporal distance between the probe and the matched right row; a
candidate whose distance exceeds the tolerance is treated as no-match.
The tieBreak rule resolves ties when multiple right rows share
the nearest match value: TieBreak.LAST (default) keeps the last such
row in input order; TieBreak.FIRST keeps the first.
-
Constructor Summary
ConstructorsConstructorDescriptionAsOfJoinNode(RelNode left, RelNode right, Predicate condition) Convenience constructor for tests; usesSourceLocation.UNKNOWN.AsOfJoinNode(RelNode left, RelNode right, Predicate condition, SourceLocation location) Convenience constructor with no tolerance, left-outer behaviour, and last-wins tie-break; uses the given source location.AsOfJoinNode(RelNode left, RelNode right, Predicate condition, Optional<Operand> tolerance, boolean inner, TieBreak tieBreak, SourceLocation location) Creates an instance of aAsOfJoinNoderecord class. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(RelNodeVisitor<R> visitor) Returns the value of theconditionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleaninner()Returns the value of theinnerrecord component.left()Returns the value of theleftrecord component.location()Returns the value of thelocationrecord component.right()Returns the value of therightrecord component.tieBreak()Returns the value of thetieBreakrecord component.Returns the value of thetolerancerecord 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
-
AsOfJoinNode
public AsOfJoinNode(RelNode left, RelNode right, Predicate condition, Optional<Operand> tolerance, boolean inner, TieBreak tieBreak, SourceLocation location) Creates an instance of aAsOfJoinNoderecord class.- Parameters:
left- the value for theleftrecord componentright- the value for therightrecord componentcondition- the value for theconditionrecord componenttolerance- the value for thetolerancerecord componentinner- the value for theinnerrecord componenttieBreak- the value for thetieBreakrecord componentlocation- the value for thelocationrecord component
-
AsOfJoinNode
Convenience constructor with no tolerance, left-outer behaviour, and last-wins tie-break; uses the given source location. -
AsOfJoinNode
Convenience constructor for tests; usesSourceLocation.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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
left
Returns the value of theleftrecord component.- Returns:
- the value of the
leftrecord component
-
right
Returns the value of therightrecord component.- Returns:
- the value of the
rightrecord component
-
condition
Returns the value of theconditionrecord component.- Returns:
- the value of the
conditionrecord component
-
tolerance
Returns the value of thetolerancerecord component.- Returns:
- the value of the
tolerancerecord component
-
inner
public boolean inner()Returns the value of theinnerrecord component.- Returns:
- the value of the
innerrecord component
-
tieBreak
Returns the value of thetieBreakrecord component.- Returns:
- the value of the
tieBreakrecord component
-
location
Returns the value of thelocationrecord component.
-