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(bigquery): transpile explode projection to cross join unnest, clean up tests #1844

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

georgesittas
Copy link
Collaborator

@georgesittas georgesittas commented Jun 28, 2023

Left a few comments to highlight the changes made in this PR. The rest are just cosmetic changes.

Comment on lines -24 to +45
self.validate_identity("""SELECT * FROM UNNEST(ARRAY<STRUCT<x INT64>>[1, 2])""")
self.validate_identity("""SELECT * FROM UNNEST(ARRAY<STRUCT<x INT64>>[])""")
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 was invalid BigQuery

Comment on lines +96 to +101
self.validate_all(
"WITH cte AS (SELECT [1, 2, 3] AS arr) SELECT col FROM cte CROSS JOIN UNNEST(arr) AS col",
read={
"spark": "WITH cte AS (SELECT ARRAY(1, 2, 3) AS arr) SELECT EXPLODE(arr) FROM cte"
},
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Covers the newly added transform (explode -> cross join unnest).

self.validate_identity("ROLLBACK TRANSACTION")
self.validate_identity("CAST(x AS BIGNUMERIC)")

self.validate_identity("SELECT * FROM UNNEST([1]) WITH ORDINALITY")
Copy link
Collaborator Author

@georgesittas georgesittas Jun 28, 2023

Choose a reason for hiding this comment

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

Removed because WITH ORDINALITY is not valid in BigQuery. The valid form is WITH OFFSET and we're testing that just below this case.

@tobymao tobymao merged commit 7cb01a0 into main Jun 28, 2023
@tobymao tobymao deleted the jo/bigquery_explode_to_unnest branch June 28, 2023 16:00
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