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

Add interface relationship aggregate filters #4856

Merged
merged 20 commits into from
Mar 18, 2024

Conversation

a-alle
Copy link
Contributor

@a-alle a-alle commented Mar 12, 2024

Description

This PR introduces aggregate filters on an interface relationship for both simple query and connections APIs, when type having a relationship is concrete or interface as well. For example, given the typedefs

interface Production {
    title: String!
}
type Movie implements Production {
    title: String!
}
type Series implements Production {
    title: String!
}
type Actor {
    name: String!
    actedIn: [Production!]! @relationship(type: "ACTED_IN", direction: OUT)
}

The generated filter type (ActorWhere) for Actor now contains the actedInAggregate field (and it also would if Actor was an interface):

input ActorWhere {
  AND: [ActorWhere!]
  OR: [ActorWhere!]
  actedInAggregate: ActorActedInAggregateInput
  actedIn: ProductionWhere
  actedIn_NOT: ProductionWhere
  actedInConnection: ActorActedInConnectionWhere
  actedInConnection_NOT: ActorActedInConnectionWhere
  name: String
  name_CONTAINS: String
  name_ENDS_WITH: String
  name_IN: [String]
  name_NOT: String
  name_NOT_CONTAINS: String
  name_NOT_ENDS_WITH: String
  name_NOT_IN: [String]
  name_NOT_STARTS_WITH: String
  name_STARTS_WITH: String
}

Complexity

Complexity: Low

Issue

Note

Please link to the GitHub issue(s) in which the proposal for this work was discussed

To link to multiple issues, use full syntax for each, for example Closes #1, closes #2, closes #3

Closes

Checklist

The following requirements should have been met (depending on the changes in the branch):

  • Documentation has been updated
  • TCK tests have been updated
  • Integration tests have been updated
  • Example applications have been updated
  • New files have copyright header
  • CLA (https://neo4j.com/developer/cla/) has been signed

Copy link

changeset-bot bot commented Mar 12, 2024

🦋 Changeset detected

Latest commit: 4255c2d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@neo4j/graphql Minor
@neo4j/graphql-ogm Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@neo4j-team-graphql
Copy link
Collaborator

Made some changes to the Neo4j GraphQL Toolbox? Or made some changes to the core library perhaps?

Check out your changes at https://neo4j-graphql-toolbox-4856.surge.sh

Use for instance a local dbms hosted on Neo4j Desktop or a cloud-hosted Aura Free dbms.

@neo4j-team-graphql
Copy link
Collaborator

neo4j-team-graphql commented Mar 12, 2024

Performance Report

No Performance Changes

Show Full Table
name dbHits old dbHits time (ms) old time (ms) maxRows
aggregations.TopLevelAggregate 3404 3404 32 49 1134
aggregations.TopLevelAggregateWithMultipleFields 6802 6802 41 58 1134
aggregations.NestedAggregation 16544 16544 59 72 2174
aggregations.AggregationWithWhere 11970 11970 40 55 2174
aggregations.AggregationWhereWithinNestedRelationships 22116478 22116478 2274 2642 2008534
aggregations.AggregationWhereWithinNestedConnections 22116478 22116478 2261 2312 2008534
aggregations.NestedCountFromMovieToActors 9701 9701 31 41 2174
aggregations.NestedCountFromActorsToMovie 9928 9928 35 40 2174
aggregations.DeeplyNestedCount 11062184 11062184 2791 2801 2008534
aggregations.InterfacesAggregations 6242 6242 42 56 2080
aggregations.InterfacesAggregationsWithTwoFields 11444 11444 67 80 2080
batch-create.BatchCreate 4200 4200 121 169 600
batch-create.BatchCreateSmall 77 77 95 64 11
connect.createAndConnect 14424 14424 144 204 3003
connections.Connection 14049 14049 70 66 2174
connections.NestedConnection 41068 41068 130 134 4516
create.SimpleMutation 7 7 53 58 1
cypher-directive.TopLevelMutationDirective 1135 1135 23 25 1134
delete.SimpleDelete 19401 19401 190 196 1040
delete.NestedDeleteInUpdate 19165 19165 169 173 2040
2871.NestedRelationshipFilter 23092 23083 68 69 4437
2925.SingleRelationshipFilter 6468 6468 34 60 1040
2925.NestedSingleRelationshipFilter 22891 22891 65 88 2174
2925.SingleRelationshipRequiredFilter 5201 5201 41 44 1040
2925.NestedSingleRelationshipRequiredFilter 9361 9361 49 69 1040
query.SimpleQuery 3121 3121 22 25 1040
query.SimpleQueryWithRelationship 16129 16129 35 40 2174
query.QueryWhere 9684 9676 29 39 2164
query.SimpleQueryWithNestedWhere 9851 9843 41 55 2164
query.Nested 10095502 10095502 6950 7267 2008534
query.NestedWithFilter 10074351 10074351 6890 6949 2004000
query.OrFilterOnRelationships 42530 42396 139 154 1706
query.OrFilterOnRelationshipsAndNested 36203 36722 170 219 1706
query.QueryWithNestedIn 13837 13449 50 63 1371
query.NestedConnectionWhere 9801 9801 49 52 2174
query.DeeplyNestedConnectionWhere 9961 9859 73 84 2174
query.DeeplyNestedWithRelationshipFilters 18950 18758 118 174 1652
query.NestedWithRelationshipSingleFilters 3865 3865 135 188 1134
query.Fulltext 64 64 27 35 16
query.FulltextWithNestedQuery 558 558 37 51 84
sorting-and-cypher.TopLevelSortWithCypher 14059 14059 35 42 2174
sorting-and-cypher.TopLevelConnectionSortWithCypher 14059 14059 54 65 2174
sorting-and-cypher.TopLevelSortWithCypherWithNested 14204 14204 50 56 2174
sorting-and-cypher.TopLevelConnectionSortWithCypherWithNested 14204 14204 99 110 2174
sorting-and-cypher.TopLevelSortWithExpensiveCypher 14887 14933 94 121 2174
sorting-and-cypher.TopLevelConnectionSortWithExpensiveCypher 14404 14404 94 123 2174
sorting.SortMultipleTypes 3498 3498 87 91 1040
sorting.SortMultipleTypesWithCypherWithCypher 14504 14504 102 125 2174
sorting.SortOnNestedFields 14049 14049 40 45 2174
sorting.SortDeeplyNestedFields 43148 43148 77 77 4516
sorting.ConnectionWithSort 3281 3281 69 87 1040
unions.SimpleUnionQuery 321 321 68 60 35
unions.SimpleUnionQueryWithMissingFields 293 293 64 57 35
unions.NestedUnion 410637 410637 245 252 33033
unions.NestedUnionWithMissingFields 384611 384611 236 266 33033
update.NestedUpdate 16143 16143 117 142 2002

Old Schema Generation: 28.000s
Schema Generation: 28.180s
Old Subgraph Schema Generation: 31.316s
Subgraph Schema Generation: 31.694s

@a-alle a-alle marked this pull request as ready for review March 12, 2024 17:11
@a-alle a-alle requested a review from angrykoala March 12, 2024 17:11
@a-alle a-alle requested a review from angrykoala March 15, 2024 17:55
@a-alle a-alle merged commit 1b52f83 into neo4j:dev Mar 18, 2024
80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pull requests
Development

Successfully merging this pull request may close these issues.

3 participants