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

SQLMesh format converts SAFE_CAST to CAST #2554

Closed
z3z1ma opened this issue May 2, 2024 · 3 comments · Fixed by #2555
Closed

SQLMesh format converts SAFE_CAST to CAST #2554

z3z1ma opened this issue May 2, 2024 · 3 comments · Fixed by #2555
Assignees

Comments

@z3z1ma
Copy link
Contributor

z3z1ma commented May 2, 2024

This is not semantically the same operation. The issue will need to be resolved in sqlglot I imagine but posting here because of its relevance in SQLMesh given the format CLI command.

image

@tobymao
Copy link
Contributor

tobymao commented May 2, 2024

@z3z1ma can you share the commands you used for this? i'm not seeing this behavior on sqlglot


q = parse_one("""
safe_cast(x as int64)
""", read="bigquery")


print(q.sql(dialect="bigquery", pretty=True))

@georgesittas
Copy link
Contributor

I can reproduce this with sqlmesh format. It converted

select max(safe_cast('bla' as int64)) as foo

into

SELECT MAX('bla'::INT64) AS foo

@georgesittas
Copy link
Contributor

I'll fix this

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 a pull request may close this issue.

3 participants