You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/docs/expressions/table_functions.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Table functions are defined in YAML extension files, similar to scalar, aggregat
30
30
Like scalar functions' return types, table function schemas follow a clear pattern:
31
31
32
32
!!! note "Required Constraint"
33
-
**If a table function's YAML definition includes an output schema, the `derived` field MUST be set to `true` in the plan, and the `table_schema` field MUST match the YAML definition (with any type parameters resolved based on the bound argument types).**
33
+
**If a table function's YAML definition includes a `return` field, the `derived` field MUST be set to `true` in the plan, and the `table_schema` field MUST match the YAML definition (with any type parameters resolved based on the bound argument types).**
34
34
35
35
**Derived schemas (`derived: true`)** - The schema can be **deterministically derived from the function signature**, including:
@@ -113,12 +113,12 @@ Table functions are represented as their own relation type, `TableFunctionRel`.
113
113
-**function_reference**: Points to a function anchor referencing the table function definition
114
114
-**arguments**: Must be constant expressions (currently; literals or expressions evaluable without input data)
115
115
-**derived**: Boolean flag indicating schema source:
116
-
-`true` - Schema determinable from function signature (concrete types or type parameters). **Required when the YAML definition includes a schema.**
117
-
-`false` - Schema depends on runtime data content. **Only allowed when the YAML definition omits the schema field.**
116
+
-`true` - Schema determinable from function signature (concrete types or type parameters). **Required when the YAML definition includes a `return` field.**
117
+
-`false` - Schema depends on runtime data content. **Only allowed when the YAML definition omits the `return` field.**
118
118
-**table_schema**: The output schema (always present). Must match the YAML definition if derived is true (with type parameters resolved). Contains the actual schema whether derived from YAML or provided by the producer.
119
119
-**common**: Standard relation properties (emit, hints, etc.)
120
120
121
-
**The key distinction:** Set `derived: true` if the schema can be determined by looking at the function signature and argument types in the YAML definition. Set `derived: false` only if the YAML definition omits the schema field because it requires inspecting runtime data content.
121
+
**The key distinction:** Set `derived: true` if the schema can be determined by looking at the function signature and argument types in the YAML definition. Set `derived: false` only if the YAML definition omits the `return` field because it requires inspecting runtime data content.
122
122
123
123
Table functions can be used anywhere a relation is expected - as a leaf node, or as input to other relational operators like `FilterRel`, `ProjectRel`, etc.
| Function Reference | Points to a function_anchor defined in the plan, referencing a table function in the extension YAML files | Required |
129
129
| Arguments | Constant expressions to pass as arguments to the function. Must match the function signature exactly. Must be literals or expressions that can be evaluated without input data. | Required |
130
-
| Derived | Boolean flag indicating schema source:<br>• `true` - Schema determinable from function signature (concrete or type-parameterized). **Must be true if YAML defines a schema.**<br>• `false` - Schema depends on runtime data content. **Only allowed if YAML omits schema.**| Required |
130
+
| Derived | Boolean flag indicating schema source:<br>• `true` - Schema determinable from function signature (concrete or type-parameterized). **Must be true if YAML defines a `return` field.**<br>• `false` - Schema depends on runtime data content. **Only allowed if YAML omits `return` field.**| Required |
131
131
| Table Schema | The output schema (NamedStruct). Always present. **Must match YAML definition (with type parameters resolved) when derived is true.**| Required |
0 commit comments