Record Class PhysicalNode.Join

java.lang.Object
java.lang.Record
com.darkcollective.relix.plan.PhysicalNode.Join
Record Components:
condition - the join predicate; empty for PhysicalNode.JoinKind.NATURAL and PhysicalNode.JoinKind.PRODUCT
keys - the equi-join key columns used for a PhysicalNode.JoinAlgorithm.HASH join (for NATURAL, the common columns); empty for a nested-loop join and products
leftRelations - relation names reachable on the left side, used to disambiguate qualified attribute references when re-evaluating condition; empty when there is no condition
rightRelations - relation names reachable on the right side
All Implemented Interfaces:
PhysicalNode
Enclosing interface:
PhysicalNode

public static record PhysicalNode.Join(Schema schema, PhysicalNode.JoinKind kind, PhysicalNode.JoinAlgorithm algorithm, PhysicalNode.BuildSide buildSide, Optional<Predicate> condition, PhysicalNode.JoinKeys keys, Set<String> leftRelations, Set<String> rightRelations, PhysicalNode left, PhysicalNode right) extends Record implements PhysicalNode
A join of any kind, carrying the chosen physical strategy.

A PhysicalNode.JoinAlgorithm.MERGE join advertises the order its sorted-merge scan produces, so a downstream merge join, streaming δ, or streaming γ can reuse it instead of re-sorting rows that are already in order.

  • Constructor Details

  • 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()
      The order a PhysicalNode.JoinAlgorithm.MERGE join delivers; Ordering.none() for every other algorithm (a hash or nested-loop scan makes no order promise). The left key column names are the ones that survive into schema() — a concatenated schema keeps the left names verbatim and only disambiguates duplicated right ones, a natural join keeps the common column from the left, and a semi/anti join's schema is the left schema — so the keys named here are always addressable in the output.

      What is claimed depends on the join kind:

      • INNER / NATURAL — the merge keys, ascending: the scan visits equal-key batches in ascending key order, so the key columns are ordered on the output regardless of how a batch's rows are paired. Built by Planner.mergeOrdering(java.util.List<java.lang.Integer>, com.darkcollective.relix.symbol.Schema) — the same call the planner uses to decide the merge is feasible, so the required and delivered orderings cannot drift apart.
      • SEMI — the left input's delivered ordering, which is at least as strong as the merge keys: the output rows are left rows, emitted as a subsequence of the left stream.
      • ANTI — nothing. The anti-join executor emits left rows with a NULL join key ahead of the sorted run (they can never match), while an ASC sort places NULLs last, so the output is not in key order. Ordering has no null-placement dimension to express the difference, so the honest answer is none().

      The other kinds never reach MERGE (see Planner.mergeEligible), and fall through to none() if one ever does.

      NULL placement does not otherwise arise here: the merge executor filters NULL-key rows out of both inputs before scanning, so — the anti-join case above aside — no NULL key reaches the output to be placed.

      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. All components in this record class are compared with Objects::equals(Object,Object).
      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
    • kind

      public PhysicalNode.JoinKind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • algorithm

      public PhysicalNode.JoinAlgorithm algorithm()
      Returns the value of the algorithm record component.
      Returns:
      the value of the algorithm record component
    • buildSide

      public PhysicalNode.BuildSide buildSide()
      Returns the value of the buildSide record component.
      Returns:
      the value of the buildSide record component
    • condition

      public Optional<Predicate> condition()
      Returns the value of the condition record component.
      Returns:
      the value of the condition record component
    • keys

      public PhysicalNode.JoinKeys keys()
      Returns the value of the keys record component.
      Returns:
      the value of the keys record component
    • leftRelations

      public Set<String> leftRelations()
      Returns the value of the leftRelations record component.
      Returns:
      the value of the leftRelations record component
    • rightRelations

      public Set<String> rightRelations()
      Returns the value of the rightRelations record component.
      Returns:
      the value of the rightRelations 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