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 queries when subquery has a union #188

Conversation

WaVEV
Copy link
Collaborator

@WaVEV WaVEV commented Nov 18, 2024

fixes #156

Copy link
Collaborator

@Jibola Jibola left a comment

Choose a reason for hiding this comment

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

Overall, LGTM.

@@ -469,6 +472,7 @@ def get_combinator_queries(self):
)
)
compiler_.pre_sql_setup()
compiler_.column_indices = self.column_indices
Copy link
Collaborator

Choose a reason for hiding this comment

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

If self.column_indices is a list, should we copy it instead?

Copy link
Collaborator Author

@WaVEV WaVEV Nov 18, 2024

Choose a reason for hiding this comment

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

No, passing by reference was on purpose, the compiler in a union query is made by multiples compilers, so those sub-compilers could use some field from the parent's parent query, then column_indices should be shared.

@timgraham timgraham changed the title Set union mapping parameter properly when a subquery has an union combinator fix queries when subquery has a union combinator Nov 18, 2024
@timgraham timgraham changed the title fix queries when subquery has a union combinator fix queries when subquery has a union Nov 18, 2024
@timgraham timgraham force-pushed the bugfix-Union-Subquery-Not-Mapping-Parent-Parameters-and-Collections-Properly branch from b69eb7e to 6f37da1 Compare November 18, 2024 22:13
@WaVEV WaVEV changed the title fix queries when subquery has a union fix queries when subquery has an union Nov 18, 2024
@WaVEV WaVEV changed the title fix queries when subquery has an union fix queries when subquery has a union Nov 18, 2024
@timgraham timgraham merged commit c49e345 into mongodb-labs:main Nov 19, 2024
8 checks passed
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.

Union Subquery Not Mapping Parent Parameters and Collections Properly.
3 participants