Record Class LateralJoinNode

java.lang.Object
java.lang.Record
com.darkcollective.relix.ast.LateralJoinNode
Record Components:
left - the outer (driving) relation; must not be null
right - the relation evaluated per left row: a RelationFunctionCall or any relation expression; must not be null
kind - whether a left row with no right rows is dropped or kept; must not be null
location - source location of the LATERAL keyword
All Implemented Interfaces:
RelNode

public record LateralJoinNode(RelNode left, RelNode right, LateralKind kind, SourceLocation location) extends Record implements RelNode
A lateral join: its right side is evaluated once per row of its left input, and may read that row's columns.

Two forms are written. left LATERAL fn(arg, …) calls a table-valued function whose arguments may name left columns; the right side is then a RelationFunctionCall. left LATERAL (expression) evaluates a relation expression in which a qualified name whose relation the expression does not read, Customers.customer_id, is a column of the left row. Each left row is joined to the rows its right side yields; OUTER also keeps, once, a left row for which the right side yields none, its right columns NULL.

Both inputs are children: a traversal sees the function call or the expression as it sees any other input. What sets the right side apart is only that it may read the left row, so it is analysed and run in the left row's scope.

  • Constructor Details

    • LateralJoinNode

      public LateralJoinNode(RelNode left, RelNode right, LateralKind kind, SourceLocation location)
      Creates an instance of a LateralJoinNode record class.
      Parameters:
      left - the value for the left record component
      right - the value for the right record component
      kind - the value for the kind record component
      location - the value for the location record component
    • LateralJoinNode

      public LateralJoinNode(RelNode left, RelNode right)
      Convenience constructor for tests: an inner lateral; uses SourceLocation.UNKNOWN.
  • Method Details

    • isFunctionCall

      public boolean isFunctionCall()
      Whether the right side is a table-valued function call, L LATERAL fn(…), rather than a relation expression in parentheses.
      Returns:
      true for the function form
    • accept

      public <R> R accept(RelNodeVisitor<R> visitor)
      Specified by:
      accept in interface RelNode
    • 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.
    • left

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

      public RelNode right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component
    • kind

      public LateralKind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • location

      public SourceLocation location()
      Returns the value of the location record component.
      Specified by:
      location in interface RelNode
      Returns:
      the value of the location record component