Copilot commented on code in PR #23438:
URL: https://github.com/apache/datafusion/pull/23438#discussion_r3557043874
##########
datafusion/sql/src/statement.rs:
##########
@@ -2641,7 +2643,7 @@ SELECT DISTINCT
FROM
(
SELECT
- i.specific_name function_name,
+ o.specific_name function_name,
o.data_type return_type,
array_agg(i.parameter_name ORDER BY i.ordinal_position ASC)
parameters,
array_agg(i.data_type ORDER BY i.ordinal_position ASC)
parameter_types
Review Comment:
With the new LEFT JOIN, functions that have an OUT row but no IN rows (e.g.
UDTFs) will produce a single joined row where `i.*` is NULL. `array_agg`
includes nulls by default, so `parameters` / `parameter_types` will become
`[NULL]` rather than empty/NULL, which is a user-visible regression in `SHOW
FUNCTIONS` output.
##########
datafusion/sql/src/statement.rs:
##########
@@ -2631,6 +2631,8 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
"".to_string()
};
+ // Note: use LEFT JOIN from OUT rows to IN rows so functions without
+ // input parameters (notably UDTFs / table functions) still appear.
let query = format!(
Review Comment:
This change adds new user-visible rows for table functions (UDTFs) in
`information_schema.routines` / `information_schema.parameters` and affects
`SHOW FUNCTIONS` output. There are existing sqllogictests in
`datafusion/sqllogictest/test_files/information_schema.slt` that cover
routines/parameters and SHOW FUNCTIONS, but none that assert table functions
appear. Adding a small assertion for a built-in table function (e.g. `unnest`)
would prevent regressions.
##########
datafusion/catalog/src/information_schema.rs:
##########
@@ -301,6 +316,25 @@ impl InformationSchemaConfig {
)
}
}
+
+ // Table functions (UDTFs) don't have scalar signatures; their return
+ // type is always a table, so emit a single row per UDTF with
+ // routine_type = "TABLE" and data_type = "TABLE".
Review Comment:
The comment says `routine_type = "TABLE"`, but the code correctly sets
`routine_type` to "FUNCTION" and `function_type` to "TABLE". This is likely to
confuse future maintainers reading the information_schema mapping.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]