-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Feat(optimizer): UDF annotation #6843
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
Conversation
b921f72 to
35466c4
Compare
35466c4 to
38d6ae1
Compare
| Returns: | ||
| The return type as a DataType, or UNKNOWN if not found. | ||
| """ | ||
| return exp.DataType.build("unknown") |
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.
This is mostly done to preserve backwards-compatibility. We could also make it abstract and label this as breaking.
cc @barakalon
65aa116 to
464d349
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0555006 to
3423b27
Compare
403144d to
dc0e462
Compare
SQLGlot Integration Test ResultsComparing:
By Dialect
Overallmain: 5247 total, 4439 passed (pass rate: 84.6%), sqlglot version: sqlglot:jo/udf_annotation: 5247 total, 4438 passed (pass rate: 84.6%), sqlglot version: Difference: No change |
This PR extends the schema module so that it can hold typing information about User-Defined Functions (UDFs).
It achieves this by introudcing a new mapping,
udf_mapping, which maps UDFs to their return type. This is separate from the existingmappingdict, because UDF and tables live in separate namespaces (e.g., for BigQuery), so we needed to respect that in order to avoid name clobbering.