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

Fix: use preprocess instead of expanding transform dicts BREAKING #1525

Merged
merged 3 commits into from
May 3, 2023

Conversation

georgesittas
Copy link
Collaborator

@georgesittas georgesittas commented May 3, 2023

Cleaned up #1524.

@tobymao I think we need to stop using the **transforms.SOME_TRANSFORM pattern, because it can easily lead to bugs in the future. For example, prior to Chris' PR we had the following entry in the TRANSFORMS map of bigquery:

exp.Select: transforms.preprocess([_unqualify_unnest])

This would cause the **transforms.ELIMINATE_DISTINCT_ON to be overridden and it's tricky to spot right away.

cc: @crericha

@tobymao
Copy link
Owner

tobymao commented May 3, 2023

can you delete the constants in transform.py?

@georgesittas
Copy link
Collaborator Author

Yeah.. Note that this will then be a breaking change.

@crericha
Copy link
Collaborator

crericha commented May 3, 2023

I think we need to stop using the **transforms.SOME_TRANSFORM pattern, because it can easily lead to bugs in the future.

I agree. I followed the pattern from the redshift dialect, without knowing there was potential for collision. The new format in this PR is much clearer and mistake proof.

@georgesittas georgesittas changed the title Fix: use preprocess instead of expanding transform dicts Fix: use preprocess instead of expanding transform dicts BREAKING May 3, 2023
@tobymao tobymao merged commit 3d964c6 into main May 3, 2023
@tobymao tobymao deleted the jo/cleanup_transforms branch May 3, 2023 19:44
adrianisk pushed a commit to adrianisk/sqlglot that referenced this pull request Jun 21, 2023
…bymao#1525)

* Fix: use preprocess instead of expanding transform dicts

* Formatting

* Remove transform variables
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