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

Support accessing members of a conditional value #35390

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

Conversation

ranma42
Copy link
Contributor

@ranma42 ranma42 commented Dec 28, 2024

This changeset adds support for accessing a member of the result of a conditional expression.

It achieves this by folding the member access into the conditional.

Fixes #34589.

@ranma42
Copy link
Contributor Author

ranma42 commented Dec 28, 2024

Note that the updated baselines point to a missing CASE simplification (CASE WHEN nonNullableX THEN TRUE ELSE FALSE END -> nonNullableX).
Additionally, the test I implemented currently hits #28077 (neither join is really needed).

I would like to add a couple of missing test cases before marking as ready:

I am also thinking that it might be a good idea to write the tests so that they do not interact with #28077, so I will probably end up rewriting the existing test. What is the best place for these tests? (if I want to check the behavior on different subclasses, maybe InheritanceQueryTestBase makes more sense 🤔 )

@ranma42 ranma42 changed the title Support accessing a members of a conditional value Support accessing members of a conditional value Dec 28, 2024
The extended `LocustHorde` has two fields which have different types but share
the same base type. This is interesting when using SQL constructs to select one
of the two fields as they are compatible but have different types.
@ranma42
Copy link
Contributor Author

ranma42 commented Jan 6, 2025

I extended the tests and kept them in GoW, as the different handling of subclassing is interesting.
In order to implement Conditional_Navigation_With_Member_Access_On_Related_Types I extended LocustHorde, which has the unfortunate side-effects of changing unrelated tests (adding a column in several SELECT queries).
I would love recommendations on possible improvements.

@ranma42 ranma42 marked this pull request as ready for review January 6, 2025 16:41
@ranma42 ranma42 requested a review from a team as a code owner January 6, 2025 16:41
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.

Support projecting different navigations (but same type) via conditional operator
1 participant