Skip to content

Conversation

@georgesittas
Copy link
Collaborator

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 existing mapping dict, because UDF and tables live in separate namespaces (e.g., for BigQuery), so we needed to respect that in order to avoid name clobbering.

Returns:
The return type as a DataType, or UNKNOWN if not found.
"""
return exp.DataType.build("unknown")
Copy link
Collaborator Author

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

This comment was marked as spam.

Repository owner deleted a comment from Copilot AI Jan 23, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

SQLGlot Integration Test Results

Comparing:

  • this branch (sqlglot:jo/udf_annotation, sqlglot version: jo/udf_annotation)
  • baseline (main, sqlglot version: 28.6.1.dev82)

⚠️ Limited to dialects: bigquery

By Dialect

dialect main sqlglot:jo/udf_annotation difference links
bigquery -> bigquery 2592/2624 passed (98.8%) 2592/2624 passed (98.8%) No change full result / delta
bigquery -> duckdb 1847/2623 passed (70.4%) 1846/2623 passed (70.4%) No change full result / delta

Overall

main: 5247 total, 4439 passed (pass rate: 84.6%), sqlglot version: 28.6.1.dev82

sqlglot:jo/udf_annotation: 5247 total, 4438 passed (pass rate: 84.6%), sqlglot version: jo/udf_annotation

Difference: No change

@georgesittas georgesittas merged commit c94284f into main Jan 26, 2026
9 checks passed
@georgesittas georgesittas deleted the jo/udf_annotation branch January 26, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants