-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce INFORMATION_SCHEMA.ROUTINES
table
#13255
base: main
Are you sure you want to change the base?
Introduce INFORMATION_SCHEMA.ROUTINES
table
#13255
Conversation
There is another useful column I wanted to add,
However, I think we don't have enough information in the function signature to do it 🤔 . |
query TTTTTTTBTTT rowsort | ||
select * from information_schema.routines where routine_name = 'date_trunc' OR routine_name = 'string_agg' OR routine_name = 'rank'; | ||
---- | ||
datafusion public date_trunc datafusion public date_trunc FUNCTION true Timestamp(Microsecond, None) SCALAR Truncates a timestamp value to a specified precision. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type name is an ArrowType name, e.g., Timestamp (Microsecond, None)
. I prefer to return a SQL type. I think it would be improved if we finished the logical type epic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree -- makes sense 👍
// TODO: Implement for other types | ||
TypeSignature::Uniform(_, _) | ||
| TypeSignature::Coercible(_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a follow-up issue for inferring the types from other TypeSignatures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should file a ticket to track adding the feature (I bet some other contributors would enjoy helping out now that you have setup the framework)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great. I filed #13271 for it.
// only handle the function which implemented [`ScalarUDFImpl::return_type`] method | ||
let return_type = udf.return_type(&arg_types).ok().map(|t| t.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some functions only implement return_type_from_exprs
, e.g., arrow_cast
. It's hard to get the return type here. Return null for this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a great start to me -- thank you @goldmedal
I think it would be really nice to file tickets for the follow on work you have identified so we don't forget (and so that others can help out)
// TODO: Implement for other types | ||
TypeSignature::Uniform(_, _) | ||
| TypeSignature::Coercible(_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should file a ticket to track adding the feature (I bet some other contributors would enjoy helping out now that you have setup the framework)
query TTTTTTTBTTT rowsort | ||
select * from information_schema.routines where routine_name = 'date_trunc' OR routine_name = 'string_agg' OR routine_name = 'rank'; | ||
---- | ||
datafusion public date_trunc datafusion public date_trunc FUNCTION true Timestamp(Microsecond, None) SCALAR Truncates a timestamp value to a specified precision. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree -- makes sense 👍
fyi @findepi |
Which issue does this PR close?
Part of #12144 .
Rationale for this change
As per the discussed in #12144 (comment), to support listing available functions, we should implement corresponding tables in the information schema.
What changes are included in this PR?
Refer to Postgres, MySQL, and BigQuery, I implemented the following columns for the
ROUTINES
table:FUNCTION
(this field could bePROCEDURE
in other databases)Immutable
scalar
,aggregate
orwindow
Are these changes tested?
yes
Are there any user-facing changes?
A new table of information_schema