Use return_field_from_args in information schema and date_trunc #20079
+62
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
return_field_from_args#19870.Rationale for this change
Some UDFs/UDAFs implement
return_field_from_args/return_fieldinstead ofreturn_type. The information schema was callingreturn_typedirectly, which fails for those functions. The default implementation ofreturn_field_from_argsalready delegates toreturn_type, so switching to the newer API works for all functions.What changes are included in this PR?
information_schema.rs:get_udf_args_and_return_typesnow callsreturn_field_from_argsinstead ofreturn_type;get_udaf_args_and_return_typesnow callsreturn_fieldinstead ofreturn_type. Removed stale comments referencing the old API.date_trunc.rs:return_typenow returnsinternal_err, andreturn_field_from_argsis self-contained (no longer delegates toreturn_type), following the same pattern as other UDFs likenamed_structandmap_from_arrays(ref: fix: derive custom nullability for sparkmap_from_arrays#19275).Are these changes tested?
Covered by existing information_schema sqllogictests and
datafusion-functionsunit tests.Are there any user-facing changes?
No.