-
Notifications
You must be signed in to change notification settings - Fork 44
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: Add basic group by functionality #43
Conversation
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in 5949c8b
This comment was generated by todo based on a
|
@ handle errordefradb/query/graphql/schema/generate.go Lines 327 to 332 in 5949c8b
This comment was generated by todo based on a
|
More info on the flacky tests:
Once the go cache decides it has passed, it can be really hard to make it fail again so clean the cache first ( Lazy command for me to reproduce (may take a few runs, warning - contains local aliases if you are not me): UPDATE: Issue fixed - see commit "Track expanded items by object and name" - issue may have been affecting production (if object has more than one parent record - e.g. book with an author and a publisher - might be worth adding tests for outside of this PR) |
Issue #46 |
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in fb55cd3
This comment was generated by todo based on a
|
fb55cd3
to
7fe6c2b
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in 7fe6c2b
This comment was generated by todo based on a
|
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in b97a202
This comment was generated by todo based on a
|
b97a202
to
26d25ec
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in 26d25ec
This comment was generated by todo based on a
|
26d25ec
to
6a66e1a
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in 6a66e1a
This comment was generated by todo based on a
|
6a66e1a
to
3a24a75
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in 3a24a75
This comment was generated by todo based on a
|
3a24a75
to
7423a89
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in 7423a89
This comment was generated by todo based on a
|
7423a89
to
fc4d2e8
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in fc4d2e8
This comment was generated by todo based on a
|
fc4d2e8
to
605e732
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in 605e732
This comment was generated by todo based on a
|
605e732
to
b6741dc
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in b6741dc
This comment was generated by todo based on a
|
b6741dc
to
82bf22e
Compare
this is incorrect for joins within `_group` collections, and should be corrected when possibledefradb/query/graphql/planner/planner.go Lines 253 to 258 in 82bf22e
This comment was generated by todo based on a
|
Tracking by object only means that arguements on child objects only get added to the one field if more than one property requires them
'f' is used everywhere else in the file
Allows a lazy-loaded cache with arbitrary reads
Note, does not yet fully implement the planNode interface and is only used within the groupNode
Test currently fails, needs more work plus cleanup. Stashing here and focusing on the main feature.
8e8206a
to
69f2633
Compare
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.
All looks good to me, is there any final things you wanted/needed to do before this gets merged?
Is this PR also fixing those OneToMany test cases that we're randomly failing? I see you added some changes to type generation stuff.
This is one of those things that might need an engineering note (or section in the DB Tech Spec) so we have a brief overview of the implementation, as well as ideas/thoughts to extend it with aggregates if you're open to writing that.
Test flackiness was fixed with commit "Track expanded items by object and name" - it might have been a production issue, but I haven't verified that. Not before it gets merged, but I would be interested in benchmarking this with large (+1,000,000) keys at somepoint - I don't know about the Go implementation but most normal map implementations can get quite slow with large numbers of records and it might be worth optimizing that at somepoint. Happy to look at adding stuff to the tech spec - will do before I pick up a new task |
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.
👍
I believe Go's map implementation holds up pretty well, but we can certainly keep an eye on it |
Added a short section to the tech spec under relationships |
* Remove commented out test code * Track expanded items by object and name Tracking by object only means that arguements on child objects only get added to the one field if more than one property requires them * Rename variable 'f' is used everywhere else in the file * Add pipe node to defra db Allows a lazy-loaded cache with arbitrary reads * Add data-source/arbitrary join node Note, does not yet fully implement the planNode interface and is only used within the groupNode * Add group-by functionality to defra db * Add support for joins within groups Test currently fails, needs more work plus cleanup. Stashing here and focusing on the main feature. * Handle pipe nodes in addSubPlan * FIXUP - Move child group field propogation into p.GroupBy
Adds basic group by functionality to defraDb. Closes #25 Closes #46
Note for reviewers:
This does not add support for joins within child groups, although the gql clients may suggest that it does (see https://github.com/sourcenetwork/defradb/tree/sisley/group-by-child-join with failing test and partial (and very WIP implementation)), please let me know your thoughts on whether this can wait or not (Group By: Support joins within _group items #46)Fixed in Group By: Support joins within _group items #46 and cherry-picked into here, see commits (Handle pipe nodes in addSubPlan
andAdd support for joins within groups
)To do: