-
Notifications
You must be signed in to change notification settings - Fork 160
Unwind create #2115
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
Merged
Merged
Unwind create #2115
Changes from 39 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
2f8f0ab
Test CypherBuilder against batch creation
MacondoExpress b3c5270
initial refactore translate-create, and test
MacondoExpress 7e89e40
add autogenerated fiels to unwind-create
MacondoExpress 93b6b16
Merge branch 'neo4j:dev' into feature/unwind-create
MacondoExpress a932360
Merge pull request #2114 from MacondoExpress/feature/unwind-create
angrykoala 7774637
remove unused imports
MacondoExpress 411e636
remove old translate-create implementation
MacondoExpress f51f26d
add projection to the unwind-create
MacondoExpress 7dacedf
Refactor unwind-create implementation
MacondoExpress 63ca55c
Refactor implementation with Simple IR
MacondoExpress 8400c47
Merge branch 'dev' into unwind-create
MacondoExpress 2fe26ef
Add integration tests for unwind-create
MacondoExpress 64047ff
Merge branch 'dev' into unwind-create
MacondoExpress a2a65f8
WIP rollback process on the UNWIND-CREATE optimisation
MacondoExpress 1b91ceb
Merge commit 'refs/pull/2115/head' of github.com:neo4j/graphql into u…
MacondoExpress 7a9260d
Bug fix
MacondoExpress 24036e2
include batch create performance test
MacondoExpress 3376a61
add performance test for interface/union, to test the not yet optimis…
MacondoExpress b1d880b
add parser test, fix edge case
MacondoExpress 72df35c
Clean up unwind-create, update tck snapshot
MacondoExpress 29fc986
update CypherBuilder MapProjection test suite
MacondoExpress 7453c3d
Apply suggestions from code review
MacondoExpress d9a748f
Lint fixes
MacondoExpress 0f560f6
Sync with dev
MacondoExpress 1599086
Merge branch 'dev' into unwind-create
MacondoExpress 4e6ef86
Sync with Dev
MacondoExpress 9b5e630
Merge branch 'dev' into unwind-create
MacondoExpress 1ec8ca3
Fixes
MacondoExpress d9f633e
High level description of the unwind-create
MacondoExpress c291965
Wording changes
MacondoExpress 3cd83ed
add type Procedure to CypherBuilder
MacondoExpress e1dcaf1
Typing fix
MacondoExpress ac34ec6
store results on a single instance of the visitor rather than initial…
MacondoExpress df1125b
Merge branch 'dev' into unwind-create
MacondoExpress fa153cf
Merge branch 'dev' into unwind-create
MacondoExpress 3b06caf
Create unwind-create.md
MacondoExpress d44f903
include changeset, extends tests capabilities
MacondoExpress 7aff0cf
include cypher builder changeset
MacondoExpress 682fc85
Update docs with some troubleshooting around the bulk create operation
MacondoExpress 2cf059c
Appy suggestions from PR
MacondoExpress ddff747
Update .changeset/unwind-create.md
MacondoExpress 163af39
remove unused code
MacondoExpress 904d10f
Merge commit 'refs/pull/2115/head' of github.com:neo4j/graphql into u…
MacondoExpress 8d4a67c
Apply suggestions from code review
MacondoExpress 601b7e3
space
MacondoExpress dce853f
Update docs/modules/ROOT/pages/troubleshooting/bulk-create.adoc
MacondoExpress 09302ad
Update docs/modules/ROOT/pages/troubleshooting/bulk-create.adoc
MacondoExpress 274c619
Apply suggestions from code review
MacondoExpress 0761afe
suggestion from PR
MacondoExpress be5f990
Apply suggestions from code review
MacondoExpress 636d746
remove barrel export from batch-create
MacondoExpress fdc13e0
update troubleshooting doc
MacondoExpress 1fa6a28
Merge branch 'dev' into unwind-create
MacondoExpress 5448ba2
remove serialize-list from utils and let it be a private member of th…
MacondoExpress c041cf5
Merge commit 'refs/pull/2115/head' of github.com:neo4j/graphql into u…
MacondoExpress 31a823a
remove root key from UnwindCreateVisitor's Environment
MacondoExpress f2ced89
Remove GitHub reference from docs
MacondoExpress 59df77f
Do not parse the GraphQLInput to generate the UNWIND statement, do no…
MacondoExpress bbfc6e8
update tck test to reflect the fact that now are passed as Cypher.Param
MacondoExpress ddc914c
remove batch/create/utils.ts
MacondoExpress 0a137a2
Merge branch 'dev' into unwind-create
MacondoExpress File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@neo4j/cypher-builder": patch | ||
| --- | ||
|
|
||
| Included List, date, localtime, localdatetime, time, randomUUID. | ||
| It's possible now to set edge properties from the Merge clause. |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@neo4j/graphql": minor | ||
| --- | ||
|
|
||
| Added the unwind-create optimization, when possible, to improve performance when a large numbers of nodes are built in single mutation | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| [[bulk-create]] | ||
| = Bulk create | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| It's possible using the Neo4jGraphQL library to create several nodes and relationships in a single mutation, however, | ||
| it's well known that performance issues are present in performing this task. | ||
| Solutions for this issue are already implemented without any input from the user, see https://github.com/neo4j/graphql/blob/dev/docs/rfcs/rfc-024-unwind-create.md. | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| However, there are still several situations where this kind of optimization is not achievable. | ||
|
|
||
| == Subscriptions enabled | ||
|
|
||
| No optimizations are available if a Subscription plugin it's being used. | ||
|
|
||
| == @populated_by | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| No optimizations are available if a Node affected by the mutation has a field with the directive @populated_by. | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| == @auth | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| No optimizations are available if a Node or Field affected by the mutation is secured with the directive @auth. | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| == Connect/ConnectOrCreate operation | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| No optimizations are available if the GraphQL input contains the connect/connectOrCreate operation. | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| == @auth | ||
|
|
||
| No optimizations are available if a Node or Field affected by the mutation is secured with the directive @auth. | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Copyright (c) "Neo4j" | ||
| * Neo4j Sweden AB [http://neo4j.com] | ||
| * | ||
| * This file is part of Neo4j. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import type { CypherEnvironment } from "../Environment"; | ||
| import { Clause } from "./Clause"; | ||
| import type { Procedure } from "../types"; | ||
|
|
||
| export class ProcedureCall extends Clause { | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private procedure: Procedure; | ||
|
|
||
| constructor(procedure: Procedure) { | ||
| super(); | ||
| this.procedure = procedure; | ||
| } | ||
|
|
||
| public getCypher(env: CypherEnvironment): string { | ||
| const procedureCypher = this.procedure.getCypher(env); | ||
MacondoExpress marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return `CALL ${procedureCypher}`; | ||
| } | ||
| } | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Copyright (c) "Neo4j" | ||
| * Neo4j Sweden AB [http://neo4j.com] | ||
| * | ||
| * This file is part of Neo4j. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import * as Cypher from "../Cypher"; | ||
|
|
||
| describe("CypherBuilder UNWIND", () => { | ||
MacondoExpress marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| test("UNWIND Movies", () => { | ||
| const matrix = new Cypher.Map({ title: new Cypher.Literal("Matrix") }); | ||
| const matrix2 = new Cypher.Map({ title: new Cypher.Literal("Matrix 2") }); | ||
| const moviesList = new Cypher.List([matrix, matrix2]); | ||
MacondoExpress marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const unwindQuery = new Cypher.Unwind([moviesList, "batch"]); | ||
| const queryResult = unwindQuery.build(); | ||
| expect(queryResult.cypher).toMatchInlineSnapshot( | ||
| `"UNWIND [ { title: \\"Matrix\\" }, { title: \\"Matrix 2\\" } ] AS batch"` | ||
| ); | ||
| expect(queryResult.params).toMatchInlineSnapshot(`Object {}`); | ||
| }); | ||
| }); | ||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Copyright (c) "Neo4j" | ||
| * Neo4j Sweden AB [http://neo4j.com] | ||
| * | ||
| * This file is part of Neo4j. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import type { CypherEnvironment } from "../../Environment"; | ||
| import type { CypherCompilable, Expr } from "../../types"; | ||
|
|
||
| import { serializeList } from "../../utils/serialize-list"; | ||
|
|
||
| /** Represents a List */ | ||
| export class ListExpr implements CypherCompilable { | ||
| private value: Expr[]; | ||
|
|
||
| constructor(value: Expr[]) { | ||
| this.value = value; | ||
| } | ||
|
|
||
| public getCypher(env: CypherEnvironment): string { | ||
| return serializeList(env, this.value); | ||
MacondoExpress marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.