getScopingInfo utility added#3118
Conversation
|
Hi @vaibhavm99, thanks for opening a PR! I should have time to give it a full review by Monday at the latest. Could I ask a bit about the motivation for the new |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3118 +/- ##
============================================
+ Coverage 77.87% 78.22% +0.35%
- Complexity 13578 13799 +221
============================================
Files 1015 1025 +10
Lines 59308 60179 +871
Branches 6835 7013 +178
============================================
+ Hits 46184 47074 +890
+ Misses 10817 10746 -71
- Partials 2307 2359 +52 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @vaibhavm99, will this change allow to save not the whole Path, but only the parts that are actually used? |
|
Hi @vkagamlyk , I'm sorry I don't understand what you mean by "the whole Path." This change should not have any breaking problems with older code, as it is just adding a new API. This would take in a traversal and provide us with the |
Hi @vaibhavm99! |
|
Hi @vaibhavm99 I'm happy with extending convenience interfaces for providers. I am curious since the |
|
I see this PR is currently targeting the master branch, this branch is currently accumulating changes for TinkerPop 4.0.0-beta.2, and ultimately TinkerPop 4. I would recommend targeting this change to |
| * | ||
| * @return A Set of {@link ScopingInfo} values which contain the label and Pop value | ||
| */ | ||
| public default Set<ScopingInfo> getScopingInfo() {return null; } |
There was a problem hiding this comment.
Should there be a default implementation here? If something implements Scoping shouldn't it have a proper implementation? or are there cases where you would return getScopeKeys but not getScopingInfo? and if so, would return null be the right default?
There was a problem hiding this comment.
Yes, there are a few classes that do not implement Pop at all, so for them we do not need getScopingInfo() but they do have getScopeKeys(). For example, AddEdgeStep and AddPropertyStep. For those I added a default. Would changing it to return an empty Set be better?
This API would not cause any breaking change in |
Yes, |
|
Thank you for the detailed review. You got it right, that we're working on optimizing label identification in prefix traversals, with the goal of only injecting necessary labels rather than the entire path. This approach could indeed be valuable for Traverser injection in TinkerPop. You've made a good point about the current limitations of the Scoping interface, particularly regarding complete label information requirements. Let me explain why the current POJO structure might be more suitable than the proposed alternative: Consider this example: In this case, the outermost where step requires [['a',Pop.first], ['b',Pop.last]], which wouldn't fit well with the proposed structure: @spmallette : I hope above example explains why an simple getPop API wont be enough. Let me know if you have better suggestions. Regarding the implementation strategy, our idea was to merge to master first and then cherry-pick to 3.7 and 3.8. Would you like to suggest any specific concerns about this approach? Looking forward to your thoughts on this. |
|
Hi @upadhyay-prashant, I'm not sure I understand the limitation arising from the above example with a simple In the case of There is never more than 1 Pop in a single step instance, I don't see why the same data as |
The typical approach for this in TinkerPop would be to target the initial PR to 3.7-dev. Whichever committer ends up merging the PR will then manually merge the changes up to 3.8-dev and master on your behalf. Typically the only time we ask contributors to open separate PRs for each branch is if each branch requires substantially different solutions for some reason. |
277612e to
d2ec3a4
Compare
|
LGTM, thanks for the change! VOTE +1 |
Cole-Greer
left a comment
There was a problem hiding this comment.
Overall it looks good to me. Left a couple of comments for small tweaks. There are a couple of steps which give their own implementation for getPopInstructions() which do not have tests in this PR, which would be nice to have (TraversalSelectStep, AddVertexStep, AddVertexStartStep, AddEdgeStep, AddEdgeStartStep). It would also be nice to have some testing for steps which directly use the default implementations in Scpoing or TraversalParent.
For all of the steps which are TraversalParents, it would be nice if the tests also validated that getPopInstructions() is successfully producing the PopInstruction's from child traversals, as well as from the step itself.
d2ec3a4 to
591e667
Compare
and TraversalParent.java, and classes that use these interfaces.
591e667 to
39c11b2
Compare
|
Thanks for coming through and making all of these changes @vaibhavm99. My vote is VOTE +1. Note that I intend to cherry pick this back to |
Added PopContaining interface, and its implementation in Scoping.java and TraversalParent.java, and classes that use these interfaces. Co-authored-by: Vaibhav Malhotra <vaimalho@amazon.com>
Added a utility function
getScopingInfo()in all classes implementingScopingand a methodgetScopingInfoForTraversalto get the labels needed by a traversal, which returns a Set ofScopingInfoclass which contains the label and Pop info.