Class JoinedRelations

java.lang.Object
dev.frostlake.metastore.model.JoinedRelations

public final class JoinedRelations extends Object
The relations a join's merged relation is assembled from, and which of them an outer join extends with NULLs: what the account's planner knows of a joined column's nullability beside its table's statistics. A relation no outer join extends keeps what its statistics prove — live tags COALESCE(a.n, 3000.5) over an inner, comma, cross or LEFT join, with a the kept side and a.n holding no NULL, by a.n's width alone. A relation an outer join extends may answer NULL whatever its table holds: a LEFT join extends its right side, a RIGHT join every relation on its left, a FULL join both, and an extended relation stays extended through every later join and filter.

Relations are compared by identity: the FROM clause gives each alias its own instance.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    includes(Table relation)
    Whether relation is one of the joined relations.
    boolean
    Whether an outer join extends relation with NULLs.
    joining(Table left, Table right, boolean leftNullExtended, boolean rightNullExtended)
    The relations of left joined to right, either of which may itself be an earlier join's merged relation.
    The first relation no outer join extends that carries columnName: the side a USING or NATURAL key written bare reads, which for a RIGHT join is its right side — live tags COALESCE(k, 3000.5) over a RIGHT JOIN b USING (k) by b.k's width alone.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • joining

      public static JoinedRelations joining(Table left, Table right, boolean leftNullExtended, boolean rightNullExtended)
      The relations of left joined to right, either of which may itself be an earlier join's merged relation.
      Parameters:
      left - the join's left input
      right - the join's right input
      leftNullExtended - whether the join extends its left input with NULLs, as RIGHT and FULL do
      rightNullExtended - whether the join extends its right input with NULLs, as LEFT and FULL do
      Returns:
      the merged relation's record
    • includes

      public boolean includes(Table relation)
      Whether relation is one of the joined relations.
      Parameters:
      relation - a relation of the FROM clause
      Returns:
      true when this join assembles it
    • isNullExtended

      public boolean isNullExtended(Table relation)
      Whether an outer join extends relation with NULLs.
      Parameters:
      relation - a relation of the FROM clause
      Returns:
      true when some outer join of the chain extends it
    • keptRelationWith

      public Table keptRelationWith(String columnName)
      The first relation no outer join extends that carries columnName: the side a USING or NATURAL key written bare reads, which for a RIGHT join is its right side — live tags COALESCE(k, 3000.5) over a RIGHT JOIN b USING (k) by b.k's width alone.
      Parameters:
      columnName - the key's name
      Returns:
      the kept relation, or null when an outer join extends every relation carrying it