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

feat: resolve relations with lateral joins #4509

Merged
merged 40 commits into from
Dec 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e1f6818
wip: joins aggregations
Weakky Oct 13, 2023
5f2ca56
wip: basic impl with lateral joins + serialization support
Weakky Oct 26, 2023
0474565
fix: iterate over record fields in serializer
Weakky Oct 26, 2023
d1f0831
wip: support to-one relation and fix serializer
Weakky Oct 26, 2023
4fb012f
add basic m2m support
Weakky Oct 26, 2023
90e6617
fix m2m support and make basic ordering + pagination work
Weakky Oct 31, 2023
0ed76a7
add SelectedField::Relation and remove RelatedQuery
Weakky Nov 27, 2023
c7a753f
add RelationLoadStrategy and feature gate joins
Weakky Nov 27, 2023
fb4ada0
update json coercion to use RelationSelection + reverse in memory whe…
Weakky Nov 27, 2023
d3e9322
split get_many_records based on relation load strategy
Weakky Nov 27, 2023
3d5ca92
update join query builder to better support filters, ordering and pag…
Weakky Nov 27, 2023
84141bd
fix: relation & relevance ordering
Weakky Nov 27, 2023
e80fb7a
fix: bring query parameter exceeded error back
Weakky Nov 27, 2023
f16fb3d
fix: avoid joins with nested aggregation selection
Weakky Nov 27, 2023
4b691a6
fix aggregated order bys
Weakky Nov 27, 2023
bd4f551
add comment trace
Weakky Nov 27, 2023
6e43413
small cleanup
Weakky Nov 27, 2023
ff68957
clippy fixes
Weakky Nov 27, 2023
02b451e
temporarily exclude batching tests
Weakky Nov 28, 2023
4ce384b
rename preview feature to "joins"
Weakky Nov 28, 2023
1598984
fix generator error test
Weakky Nov 28, 2023
fd25b20
clippy fixes
Weakky Nov 28, 2023
86ee2f5
remove mssql support
Weakky Nov 28, 2023
d5c9986
fix ordering on CRDB & refactor sql builder
Weakky Nov 30, 2023
8988c8c
fix crdb tests
Weakky Nov 30, 2023
9710c41
cleanup
Weakky Nov 30, 2023
defe57a
add scalar coercion tests + handle coercion errors
Weakky Nov 30, 2023
6068b98
cleanup error message
Weakky Dec 1, 2023
bc60a31
fix driver adapter enum selection
Weakky Dec 1, 2023
a84fe43
rename preview feature from joins to relationJoins
Weakky Dec 1, 2023
410139e
fix unit test
Weakky Dec 1, 2023
e96f014
Merge remote-tracking branch 'origin/main' into integration/join-support
aqrln Dec 4, 2023
e04e5f6
exclude tests + reframe error message
Weakky Dec 4, 2023
28d5206
undo some test changes
Weakky Dec 4, 2023
c4f05a6
rename "data" to "__prisma_data__"
Weakky Dec 4, 2023
cede9be
add findUnique support
Weakky Dec 4, 2023
91d579b
Fix wasm build script
aqrln Dec 4, 2023
6e804a0
fix tests and remove dbg
Weakky Dec 4, 2023
8109c3f
hack: filter null values from joined JSON arrays
Weakky Dec 4, 2023
d6d5262
Merge branch 'main' into integration/join-support
Weakky Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix crdb tests
Weakky committed Dec 1, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 8988c8c98648a72b2d202cf1aaca5bcd4f49543c
Original file line number Diff line number Diff line change
@@ -434,7 +434,7 @@ mod multi_schema {
insta::assert_snapshot!(
run_query!(&runner, r#"
query {
findManyCategoriesOnPosts(where: {postId: {gt: 0}}) {
findManyCategoriesOnPosts(orderBy: [{ postId: asc }, { categoryId: asc }], where: {postId: {gt: 0}}) {
category {
name
},
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ mod paging_one2m_stable_order {
// Makes: [1 => 2, 2 => 3, 3 => 5]
insta::assert_snapshot!(
run_query!(&runner, r#"query {
findManyTestModel {
findManyTestModel(orderBy: { id: asc }) {
id
related(take: 1, orderBy: [{ fieldA: desc }, {fieldB: asc }, { fieldC: asc }, { fieldD: desc }]) {
id
@@ -73,7 +73,7 @@ mod paging_one2m_stable_order {
// Makes: [1 => 1, 2 => 4, 3 => 6]
insta::assert_snapshot!(
run_query!(&runner, r#"query {
findManyTestModel {
findManyTestModel(orderBy: { id: asc}) {
id
related(take: -1, orderBy: [{ fieldA: desc }, { fieldB: asc }, { fieldC: asc }, { fieldD: desc }]) {
id
@@ -185,7 +185,7 @@ mod paging_one2m_unstable_order {
run_query!(
&runner,
r#"query {
findManyTestModel {
findManyTestModel(orderBy: { id: asc }) {
id
related(take: 1, orderBy: [{ fieldA: desc }, {fieldB: asc }, { fieldC: asc }, { fieldD: desc }]) {
id
@@ -214,7 +214,7 @@ mod paging_one2m_unstable_order {
run_query!(
&runner,
r#"query {
findManyTestModel {
findManyTestModel(orderBy: { id: asc }) {
id
related(take: -1, orderBy: [{ fieldA: desc }, { fieldB: asc }, { fieldC: asc }, { fieldD: desc }]) {
id
Original file line number Diff line number Diff line change
@@ -79,12 +79,12 @@ mod order_by_aggr {
run_query!(&runner, r#"{
findManyPost(orderBy: { categories: { _count: asc } }) {
title
categories {
categories(orderBy: { name: asc }) {
name
}
}
}"#),
@r###"{"data":{"findManyPost":[{"title":"bob_post_1","categories":[{"name":"Finance"}]},{"title":"alice_post_1","categories":[{"name":"News"},{"name":"Society"}]},{"title":"bob_post_2","categories":[{"name":"History"},{"name":"Gaming"},{"name":"Hacking"}]}]}}"###
@r###"{"data":{"findManyPost":[{"title":"bob_post_1","categories":[{"name":"Finance"}]},{"title":"alice_post_1","categories":[{"name":"News"},{"name":"Society"}]},{"title":"bob_post_2","categories":[{"name":"Gaming"},{"name":"Hacking"},{"name":"History"}]}]}}"###
);

Ok(())
@@ -98,12 +98,12 @@ mod order_by_aggr {
run_query!(&runner, r#"{
findManyPost(orderBy: { categories: { _count: desc } }) {
title
categories {
categories(orderBy: { name :asc }) {
name
}
}
}"#),
@r###"{"data":{"findManyPost":[{"title":"bob_post_2","categories":[{"name":"History"},{"name":"Gaming"},{"name":"Hacking"}]},{"title":"alice_post_1","categories":[{"name":"News"},{"name":"Society"}]},{"title":"bob_post_1","categories":[{"name":"Finance"}]}]}}"###
@r###"{"data":{"findManyPost":[{"title":"bob_post_2","categories":[{"name":"Gaming"},{"name":"Hacking"},{"name":"History"}]},{"title":"alice_post_1","categories":[{"name":"News"},{"name":"Society"}]},{"title":"bob_post_1","categories":[{"name":"Finance"}]}]}}"###
);

Ok(())
@@ -159,12 +159,12 @@ mod order_by_aggr {
run_query!(&runner, r#"{
findManyPost(orderBy: [{ categories: { _count: asc } }, { title: asc }]) {
title
categories {
categories(orderBy: { name: asc }) {
name
}
}
}"#),
@r###"{"data":{"findManyPost":[{"title":"bob_post_1","categories":[{"name":"Finance"}]},{"title":"alice_post_1","categories":[{"name":"News"},{"name":"Society"}]},{"title":"bob_post_2","categories":[{"name":"History"},{"name":"Gaming"},{"name":"Hacking"}]}]}}"###
@r###"{"data":{"findManyPost":[{"title":"bob_post_1","categories":[{"name":"Finance"}]},{"title":"alice_post_1","categories":[{"name":"News"},{"name":"Society"}]},{"title":"bob_post_2","categories":[{"name":"Gaming"},{"name":"Hacking"},{"name":"History"}]}]}}"###
);

Ok(())
@@ -181,12 +181,12 @@ mod order_by_aggr {
user {
name
}
categories {
categories(orderBy: { name: asc }) {
name
}
}
}"#),
@r###"{"data":{"findManyPost":[{"user":{"name":"Alice"},"categories":[{"name":"News"},{"name":"Society"}]},{"user":{"name":"Bob"},"categories":[{"name":"History"},{"name":"Gaming"},{"name":"Hacking"}]},{"user":{"name":"Bob"},"categories":[{"name":"Finance"}]}]}}"###
@r###"{"data":{"findManyPost":[{"user":{"name":"Alice"},"categories":[{"name":"News"},{"name":"Society"}]},{"user":{"name":"Bob"},"categories":[{"name":"Gaming"},{"name":"Hacking"},{"name":"History"}]},{"user":{"name":"Bob"},"categories":[{"name":"Finance"}]}]}}"###
);

Ok(())
@@ -571,7 +571,7 @@ mod order_by_aggr {
findManyPost(orderBy: [{ categories: { _count: asc } }, { title: asc }], cursor: { id: 2 }, take: 2) {
id
title
categories {
categories(orderBy: { name: asc }) {
name
}
}