diff --git a/datafusion/sqllogictest/test_files/information_schema.slt b/datafusion/sqllogictest/test_files/information_schema.slt index b61ceecb24fc0..d58fead3e7f32 100644 --- a/datafusion/sqllogictest/test_files/information_schema.slt +++ b/datafusion/sqllogictest/test_files/information_schema.slt @@ -812,6 +812,49 @@ select is_deterministic from information_schema.routines where routine_name = 'n ---- false +# Test window function return types in information_schema.routines +# Before PR #20079, window functions would show NULL for data_type +# This test verifies that UDWF return types are correctly reported + +query TTT +select routine_name, data_type, function_type from information_schema.routines where routine_name = 'row_number'; +---- +row_number NULL WINDOW + +query TTT +select routine_name, data_type, function_type from information_schema.routines where routine_name = 'rank'; +---- +rank NULL WINDOW + +query TTT +select routine_name, data_type, function_type from information_schema.routines where routine_name = 'dense_rank'; +---- +dense_rank NULL WINDOW + +query TTT +select routine_name, data_type, function_type from information_schema.routines where routine_name = 'lag'; +---- +lag NULL WINDOW + +query TTT +select routine_name, data_type, function_type from information_schema.routines where routine_name = 'lead'; +---- +lead NULL WINDOW + +# Test that window functions return types match their actual behavior +# row_number, rank, dense_rank all return NULL (no return type in signature) +# lag and lead return types depend on their input (shown as NULL in generic signature) +query TTTB +select routine_name, data_type, function_type, is_deterministic +from information_schema.routines +where function_type = 'WINDOW' + and (routine_name = 'row_number' OR routine_name = 'rank' OR routine_name = 'dense_rank') +order by routine_name; +---- +dense_rank NULL WINDOW true +rank NULL WINDOW true +row_number NULL WINDOW true + # test every function type are included in the result query TTTITTTTBI select * from information_schema.parameters where specific_name = 'date_trunc' OR specific_name = 'string_agg' OR specific_name = 'rank' ORDER BY specific_name, rid, data_type;