Skip to content

Commit bc09156

Browse files
committed
fix: table functions output as return instead of schema
This is for consistency with other functions
1 parent 73b0885 commit bc09156

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

extensions/functions_table.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ table_functions:
2828
constant: true
2929
deterministic: true
3030
sessionDependent: false
31-
schema:
31+
return:
3232
names:
3333
- value
3434
struct:
@@ -47,7 +47,7 @@ table_functions:
4747
constant: true
4848
deterministic: true
4949
sessionDependent: false
50-
schema:
50+
return:
5151
names:
5252
- value
5353
struct:
@@ -62,7 +62,7 @@ table_functions:
6262
description: The ending value of the series (inclusive)
6363
deterministic: true
6464
sessionDependent: false
65-
schema:
65+
return:
6666
names:
6767
- value
6868
struct:
@@ -77,7 +77,7 @@ table_functions:
7777
description: The ending value of the series (inclusive)
7878
deterministic: true
7979
sessionDependent: false
80-
schema:
80+
return:
8181
names:
8282
- value
8383
struct:
@@ -99,7 +99,7 @@ table_functions:
9999
sessionDependent: false
100100
# Schema references type parameter T from list<T>
101101
# The field type is derived from the list element type
102-
schema:
102+
return:
103103
names:
104104
- element
105105
struct:

site/docs/expressions/table_functions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Table functions are defined in YAML extension files, similar to scalar, aggregat
3030
Like scalar functions' return types, table function schemas follow a clear pattern:
3131

3232
!!! 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).**
3434

3535
**Derived schemas (`derived: true`)** - The schema can be **deterministically derived from the function signature**, including:
3636
- **Static schemas**: Fixed output regardless of argument values (e.g., `generate_series` always produces `{value: i64}`)
@@ -113,12 +113,12 @@ Table functions are represented as their own relation type, `TableFunctionRel`.
113113
- **function_reference**: Points to a function anchor referencing the table function definition
114114
- **arguments**: Must be constant expressions (currently; literals or expressions evaluable without input data)
115115
- **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.**
118118
- **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.
119119
- **common**: Standard relation properties (emit, hints, etc.)
120120

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.
122122

123123
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.
124124

site/docs/relations/logical_relations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Like scalar function return types, table function schemas can be concrete types
127127
| ------------------ | ------------------------------------------------------------ | -------- |
128128
| Function Reference | Points to a function_anchor defined in the plan, referencing a table function in the extension YAML files | Required |
129129
| 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 |
131131
| Table Schema | The output schema (NamedStruct). Always present. **Must match YAML definition (with type parameters resolved) when derived is true.** | Required |
132132

133133
### Use Cases

text/simple_extensions_schema.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ $defs:
334334
$ref: "#/$defs/sessionDependent"
335335
deterministic:
336336
$ref: "#/$defs/deterministic"
337-
schema:
338-
# The output schema.
337+
return:
338+
# The output schema (NamedStruct).
339339
# Omit this field only if the schema depends on runtime data content
340340
# (not determinable from function signature).
341341
$ref: "#/$defs/type"

0 commit comments

Comments
 (0)