Record Class RelationFunctionSymbol
- Record Components:
namespace- the namespace this symbol belongs to; must not be blankdeclaredName- the name as written by the user; must not be blankprovenance- built-in or user-defined; must not be nullshadowPolicy- replacement policy; must not be nullparameters- ordered parameter definitions; must not be nullbody- the relational-algebra expression defining the result; must not be nullreturnSchema- the body's inferred output schema; absent until inference resolves it
- All Implemented Interfaces:
FunctionSymbol,Symbol
Where a ScalarFunctionSymbol accepts scalar arguments and yields a
single scalar value, a RelationFunctionSymbol accepts scalar arguments
and yields a whole relation: its body() is a relational-algebra
RelNode expression, and its return "type" is a relation schema rather
than a ScalarType. A table-valued function is declared with
def name(p: T, …): RELATION := \{ <RA expression> \} — where a parameter
may itself be a relation, E: RELATION(src, dst) — and invoked in
relation position (as a RelationFunctionCall RelNode).
Binding is by substitution: a call's argument expressions replace the matching parameter references in the body, and the resulting relational expression is inlined by the planner. Because the binding is purely syntactic, this models a parameterized view.
The returnSchema() is the body's inferred output schema; it is
empty until the schema-inference phase has resolved it (mirroring how a
QueryRelationSymbol's schema
is filled in after inference).
FunctionSymbol contract
A relation function carries no scalar return type; returnType()
therefore reports ScalarType.ANY as a neutral placeholder (it is not
meaningful for a relation function — consumers that distinguish the two
function kinds should pattern-match on the concrete type). It declares no
optimizer properties.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRelationFunctionSymbol(String namespace, String declaredName, Provenance provenance, ShadowPolicy shadowPolicy, List<ParameterDefinition> parameters, RelNode body, Optional<Schema> returnSchema) Creates an instance of aRelationFunctionSymbolrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbody()Returns the value of thebodyrecord component.Returns a newRelationFunctionSymbol.Builderfor aRelationFunctionSymbolwith the given declared name.Returns the value of thedeclaredNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thenamespacerecord component.Returns the value of theparametersrecord component.Table-valued functions declare no optimizer hint flags.Returns the value of theprovenancerecord component.Returns the value of thereturnSchemarecord component.The scalar return type, reported asScalarType.ANY— a relation function does not return a scalar value (seereturnSchema()).Returns the value of theshadowPolicyrecord component.final StringtoString()Returns a string representation of this record class.withReturnSchema(Schema schema) Returns a copy of this symbol with itsreturnSchema()resolved toschema— used by the inference phase once the body's output schema has been derived.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.darkcollective.relix.symbol.function.FunctionSymbol
parameterSignatureMethods inherited from interface com.darkcollective.relix.symbol.Symbol
canonicalName
-
Constructor Details
-
RelationFunctionSymbol
public RelationFunctionSymbol(String namespace, String declaredName, Provenance provenance, ShadowPolicy shadowPolicy, List<ParameterDefinition> parameters, RelNode body, Optional<Schema> returnSchema) Creates an instance of aRelationFunctionSymbolrecord class.- Parameters:
namespace- the value for thenamespacerecord componentdeclaredName- the value for thedeclaredNamerecord componentprovenance- the value for theprovenancerecord componentshadowPolicy- the value for theshadowPolicyrecord componentparameters- the value for theparametersrecord componentbody- the value for thebodyrecord componentreturnSchema- the value for thereturnSchemarecord component
-
-
Method Details
-
returnType
The scalar return type, reported asScalarType.ANY— a relation function does not return a scalar value (seereturnSchema()).- Specified by:
returnTypein interfaceFunctionSymbol- Returns:
ScalarType.ANY; never null
-
properties
Table-valued functions declare no optimizer hint flags.- Specified by:
propertiesin interfaceFunctionSymbol- Returns:
- the empty set; never null
-
withReturnSchema
Returns a copy of this symbol with itsreturnSchema()resolved toschema— used by the inference phase once the body's output schema has been derived.- Parameters:
schema- the resolved body schema; must not be null- Returns:
- a new
RelationFunctionSymbolcarrying the resolved schema
-
builder
Returns a newRelationFunctionSymbol.Builderfor aRelationFunctionSymbolwith the given declared name.Builder defaults:
namespace→"default",provenance→Provenance.USER,shadowPolicy→ShadowPolicy.PERMITTED,parameters→ empty,returnSchema→Optional.empty().- Parameters:
name- the declared function name; must not be blank- Returns:
- a fresh builder
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
namespace
Returns the value of thenamespacerecord component. -
declaredName
Returns the value of thedeclaredNamerecord component.- Specified by:
declaredNamein interfaceSymbol- Returns:
- the value of the
declaredNamerecord component
-
provenance
Returns the value of theprovenancerecord component.- Specified by:
provenancein interfaceSymbol- Returns:
- the value of the
provenancerecord component
-
shadowPolicy
Returns the value of theshadowPolicyrecord component.- Specified by:
shadowPolicyin interfaceSymbol- Returns:
- the value of the
shadowPolicyrecord component
-
parameters
Returns the value of theparametersrecord component.- Specified by:
parametersin interfaceFunctionSymbol- Returns:
- the value of the
parametersrecord component
-
body
Returns the value of thebodyrecord component.- Returns:
- the value of the
bodyrecord component
-
returnSchema
Returns the value of thereturnSchemarecord component.- Returns:
- the value of the
returnSchemarecord component
-