Record Class DefRelationStatement

java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.DefRelationStatement
Record Components:
exported - true unless the private modifier is present
name - the function name; must not be blank
parameters - the typed parameter list; must not be null
body - the relational-algebra expression body; must not be null
location - the source location of this statement; never null
All Implemented Interfaces:
Statement

public record DefRelationStatement(boolean exported, String name, List<ParameterDefinition> parameters, RelNode body, SourceLocation location) extends Record implements Statement
A def … : relation statement — defines a table-valued (relation-returning) user-defined function.

Syntax:

   def recentOrders(cid: NUMBER): RELATION := {
       σ customer_id = cid ∧ status = "completed" (Orders)
   };

   private def activeUsers(): RELATION := { σ status = "active" (Users) };
 

The : RELATION return-type annotation distinguishes this from the scalar DefStatement; the body is a fully-parsed relational-algebra RelNode expression (delegated to the RA parser), not a scalar operand.

A DefRelationStatement corresponds directly to a RelationFunctionSymbol — the semantic layer creates the symbol and registers it in the symbol table.

  • Constructor Details

  • Method Details

    • of

      public static DefRelationStatement of(String name, List<ParameterDefinition> parameters, RelNode body)
      Creates an exported table-valued-function def statement (the common case).
    • 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.
    • exported

      public boolean exported()
      Returns the value of the exported record component.
      Returns:
      the value of the exported record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • parameters

      public List<ParameterDefinition> parameters()
      Returns the value of the parameters record component.
      Returns:
      the value of the parameters record component
    • body

      public RelNode body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • location

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