-
Notifications
You must be signed in to change notification settings - Fork 238
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
impr(qe): PostgreSQL DISTINCT ON
w/ ORDER BY
#4525
Open
Druue
wants to merge
16
commits into
main
Choose a base branch
from
impr/distinct-orderby
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CodSpeed Performance ReportMerging #4525 will not alter performanceComparing Summary
|
Druue
force-pushed
the
impr/distinct-orderby
branch
from
December 7, 2023 16:04
2849c72
to
b956a94
Compare
Druue
requested review from
laplab,
jkomyno and
Weakky
and removed request for
a team
December 20, 2023 06:39
Druue
commented
Dec 20, 2023
Comment on lines
112
to
133
fn can_orderby_with_in_db_distinct(&self) -> bool { | ||
match &self.distinct { | ||
Some(distinct) => { | ||
let dist_len = distinct.as_fields().len(); | ||
|
||
if self.order_by.len() <= dist_len { | ||
Self::ord_matches_distinct(&self.order_by, distinct) | ||
} else { | ||
let initial_order = &self.order_by[0..dist_len]; | ||
|
||
Self::ord_matches_distinct(initial_order, distinct) | ||
} | ||
} | ||
None => unreachable!(), | ||
} | ||
} | ||
|
||
fn ord_matches_distinct(order_by: &[OrderBy], distinct: &FieldSelection) -> bool { | ||
order_by | ||
.iter() | ||
.all(|ord| distinct.contains(ord.field().unwrap().name())) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orderBy
support added here
WASM Size
|
✅ WASM query-engine performance won't change substantially (1.002x)Full benchmark report
After changes in fe44013 |
Druue
changed the title
impr(qe): PostgreSQL DISTINCT ON w/ ORDER BY
impr(qe): PostgreSQL Dec 20, 2023
DISTINCT ON
w/ ORDER BY
Druue
force-pushed
the
impr/distinct-orderby
branch
from
January 2, 2024 13:22
e0da8e7
to
0843a9c
Compare
Druue
force-pushed
the
impr/distinct-orderby
branch
from
January 4, 2024 19:52
67add4a
to
c586e0f
Compare
Weakky
reviewed
Jan 5, 2024
Weakky
reviewed
Jan 5, 2024
query-engine/connector-test-kit-rs/query-engine-tests/tests/queries/distinct.rs
Outdated
Show resolved
Hide resolved
- Pass down parent from find_related - Pass down then to finalize_arguments Updated finalize_arguments - Implictly add relation_ids to find_related distinct queries
nested_distinct_title
- append relation_id to end of distinct set
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added support for connector based results for tests where it makes sense.
OrderBy tests will always return data in specific orders and can therefore keep the snapshots.
Note!⚠️
Per internal discussion, this PR will be scoped so as to only provide support for one-to-many relations. Support for many-to-many relations will be moved to a different PR
contributes prisma/prisma#14765
closes https://github.com/prisma/team-orm/issues/775
follow-up for #4223