Record Class PhysicalNode.AsOfJoin

java.lang.Object
java.lang.Record
com.darkcollective.relix.plan.PhysicalNode.AsOfJoin
Record Components:
partitionKeys - the equality (partition) key columns, left/right indices
leftMatchIndex - the probe's match (ordering) column index
rightMatchIndex - the right input's match (ordering) column index
tolerance - optional maximum temporal distance for the match
inner - when true, drop unmatched probes
tieBreak - tie-break rule for tied nearest-match values
All Implemented Interfaces:
PhysicalNode
Enclosing interface:
PhysicalNode

public static record PhysicalNode.AsOfJoin(Schema schema, PhysicalNode.JoinKeys partitionKeys, int leftMatchIndex, int rightMatchIndex, boolean backward, boolean strict, Optional<Duration> tolerance, boolean inner, TieBreak tieBreak, PhysicalNode left, PhysicalNode right) extends Record implements PhysicalNode
AS-OF join — a temporal "pick the nearest right row by time" join. For each left (probe) row, among the right rows agreeing on the partitionKeys and satisfying the ordering relation between leftMatchIndex and rightMatchIndex, emits the probe concatenated with the single nearest right row.

backward selects the direction: true keeps the greatest right[match] at-or-before the probe ("most recent as-of"), false keeps the least right[match] at-or-after. strict excludes an exact-value match (a >/< condition rather than >=/<=).

When inner is false (default, left-outer), every probe survives with NULL right columns on no match. When true (inner), unmatched probes are dropped.

An optional tolerance imposes a maximum temporal distance between the probe and the matched right row; a candidate exceeding the tolerance is treated as no-match.

tieBreak resolves ties among right rows sharing the nearest match value: LAST keeps the last in input order (default); FIRST keeps the first.

  • Constructor Details

    • AsOfJoin

      public AsOfJoin(Schema schema, PhysicalNode.JoinKeys partitionKeys, int leftMatchIndex, int rightMatchIndex, boolean backward, boolean strict, PhysicalNode left, PhysicalNode right)
      Convenience constructor preserving backward compatibility (no tolerance, left-outer, LAST).
    • AsOfJoin

      public AsOfJoin(Schema schema, PhysicalNode.JoinKeys partitionKeys, int leftMatchIndex, int rightMatchIndex, boolean backward, boolean strict, Optional<Duration> tolerance, boolean inner, TieBreak tieBreak, PhysicalNode left, PhysicalNode right)
      Creates an instance of a AsOfJoin record class.
      Parameters:
      schema - the value for the schema record component
      partitionKeys - the value for the partitionKeys record component
      leftMatchIndex - the value for the leftMatchIndex record component
      rightMatchIndex - the value for the rightMatchIndex record component
      backward - the value for the backward record component
      strict - the value for the strict record component
      tolerance - the value for the tolerance record component
      inner - the value for the inner record component
      tieBreak - the value for the tieBreak record component
      left - the value for the left record component
      right - the value for the right record component
  • Method Details

    • children

      public List<PhysicalNode> children()
      Description copied from interface: PhysicalNode
      Direct child plans, left-to-right; empty for a PhysicalNode.Scan.
      Specified by:
      children in interface PhysicalNode
    • deliveredOrdering

      public Ordering deliveredOrdering()
      Description copied from interface: PhysicalNode
      The Ordering that this node delivers on its output stream. The default implementation returns Ordering.none() — meaning no guaranteed row order — which is the conservative safe answer for any operator that does not propagate or establish an ordering. Individual nodes that do preserve order (PhysicalNode.Select, PhysicalNode.Limit) or establish it (PhysicalNode.Sort) override this method.
      Specified by:
      deliveredOrdering in interface PhysicalNode
      Returns:
      the delivered ordering; never null
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • schema

      public Schema schema()
      Returns the value of the schema record component.
      Specified by:
      schema in interface PhysicalNode
      Returns:
      the value of the schema record component
    • partitionKeys

      public PhysicalNode.JoinKeys partitionKeys()
      Returns the value of the partitionKeys record component.
      Returns:
      the value of the partitionKeys record component
    • leftMatchIndex

      public int leftMatchIndex()
      Returns the value of the leftMatchIndex record component.
      Returns:
      the value of the leftMatchIndex record component
    • rightMatchIndex

      public int rightMatchIndex()
      Returns the value of the rightMatchIndex record component.
      Returns:
      the value of the rightMatchIndex record component
    • backward

      public boolean backward()
      Returns the value of the backward record component.
      Returns:
      the value of the backward record component
    • strict

      public boolean strict()
      Returns the value of the strict record component.
      Returns:
      the value of the strict record component
    • tolerance

      public Optional<Duration> tolerance()
      Returns the value of the tolerance record component.
      Returns:
      the value of the tolerance record component
    • inner

      public boolean inner()
      Returns the value of the inner record component.
      Returns:
      the value of the inner record component
    • tieBreak

      public TieBreak tieBreak()
      Returns the value of the tieBreak record component.
      Returns:
      the value of the tieBreak record component
    • left

      public PhysicalNode left()
      Returns the value of the left record component.
      Returns:
      the value of the left record component
    • right

      public PhysicalNode right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component