Skip to content
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

feat(bigquery): Native annotations for more math functions #4212

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

VaggelisD
Copy link
Collaborator

@VaggelisD VaggelisD commented Oct 4, 2024

This is a follow up to #4201

Several BigQuery functions such as CEIL(x), FLOOR(x) etc will borrow the input type unless that is an INT, in which case a FLOAT64 (i.e DataType.DOUBLE) is returned.

To mimic this behavior, this PR adds a new type annotation helper.

Note: The function TRUNC(X) is not currently supported by SQLGlot so once that's added, it must also be annotated accordingly.

Docs

BQ Mathematical Functions

Copy link
Collaborator

@georgesittas georgesittas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments, LGTM otherwise.

sqlglot/dialects/bigquery.py Outdated Show resolved Hide resolved
sqlglot/dialects/bigquery.py Outdated Show resolved Hide resolved
sqlglot/dialects/bigquery.py Outdated Show resolved Hide resolved
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.

2 participants