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
{{ message }}
Repository navigation
Commit fb26fd9
Browse filesBrowse the repository at this point in the historyBrowse files
## Which issue does this PR close?
No issue — this is a follow-up to apache#21679.
## Rationale for this change
In `ScalarUDF`, arity is enforced by the framework via `TypeSignature`.
In `HigherOrderUDF`, functions with a fixed number of value and lambda
arguments had to use `UserDefined` and manually validate arity inside
`coerce_value_types`, which is boilerplate that every implementor has to
repeat.
## What changes are included in this PR?
Adds `HigherOrderTypeSignature::Exact { values: usize, lambdas: usize }
`variant that enforces a fixed count of value and lambda arguments,
calling coerce_value_types only for type coercion as well
## Are these changes tested?
Yes I added some planning tests for exact siganture in
`datafusion/expr/src/type_coercion/functions.rs`
## Are there any user-facing changes?
Yes a new signature for HigherOrderSignature was added.
Copy file name to clipboardExpand all lines: datafusion/sqllogictest/test_files/array/array_transform.slt
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -396,13 +396,13 @@ physical_plan
396
396
query error
397
397
select array_transform();
398
398
----
399
-
DataFusion error: Error during planning: array_transform function requires 1 value arguments, got 0
399
+
DataFusion error: Error during planning: The function 'array_transform' expected 2 argument(s) but received 0
400
400
401
401
402
402
query error DataFusion error: Error during planning: array_transform expected a list as first argument, got Int64
403
403
select array_transform(1, v -> v*2);
404
404
405
-
query error DataFusion error: Error during planning: array_transform expects a value followed by a lambda, got Lambda\(None\) and Value\(Field \{ name: "make_array\(Int64\(1\),Int64\(2\)\)", data_type: List\(Field \{ data_type: Int64, nullable: true \}\), nullable: true \}\)
405
+
query error DataFusion error: Error during planning: The function 'array_transform' expected a value at position 0 but received a lambda
406
406
select array_transform(v -> v*2, [1, 2]);
407
407
408
408
query error DataFusion error: Error during planning: lambda defined 3 params but UDF support only 1
0 commit comments