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

Introduce new marker interfaces to identify whether a step can perform write or delete or both on graph data and static map to capture steps associated with an operator #2025

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

phanindhra876
Copy link
Contributor

Currently all steps that can change graph data implements Mutating interface. However, there is no straight forward way to know whether the step can perform write or delete or both on the graph data. This PR introduces two new marker interfaces Writing and Deleting defining whether step can perform write or delete or both.

In addition to this, this PR creates a static map of Traversal steps that shall be added for a given operator. Both can be combined to assess whether a given query can perform read or write or delete or any combination of these before query execution.

@codecov-commenter
Copy link

codecov-commenter commented Apr 17, 2023

Codecov Report

Merging #2025 (a56f8ad) into 3.6-dev (e5ef74b) will increase coverage by 0.09%.
The diff coverage is 98.40%.

@@              Coverage Diff              @@
##             3.6-dev    #2025      +/-   ##
=============================================
+ Coverage      69.44%   69.54%   +0.09%     
- Complexity      9347     9351       +4     
=============================================
  Files            878      878              
  Lines          42103    42228     +125     
  Branches        5643     5643              
=============================================
+ Hits           29239    29366     +127     
+ Misses         10869    10868       -1     
+ Partials        1995     1994       -1     
Impacted Files Coverage Δ
...remlin/process/traversal/step/filter/DropStep.java 70.58% <ø> (ø)
...n/process/traversal/step/map/AddEdgeStartStep.java 84.21% <ø> (ø)
...remlin/process/traversal/step/map/AddEdgeStep.java 85.00% <ø> (ø)
...process/traversal/step/map/AddVertexStartStep.java 80.00% <ø> (ø)
...mlin/process/traversal/step/map/AddVertexStep.java 71.05% <ø> (ø)
.../gremlin/process/traversal/step/map/MergeStep.java 75.75% <ø> (ø)
...ess/traversal/step/sideEffect/AddPropertyStep.java 78.31% <ø> (ø)
...gremlin/process/traversal/util/BytecodeHelper.java 85.05% <98.40%> (+34.03%) ⬆️

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

phanindhra876

This comment was marked as off-topic.

@phanindhra876 phanindhra876 marked this pull request as ready for review April 17, 2023 17:29
@kenhuuu
Copy link
Contributor

kenhuuu commented Apr 18, 2023

Thanks for contributing this. It may also be nice to add a section to the upgrade documentation for providers to let them know about this new feature.

VOTE +1

@vkagamlyk
Copy link
Contributor

VOTE+1

@Cole-Greer
Copy link
Contributor

Thanks @phanindhra876 for these changes. Overall they look good to me. My main question is if we've actually covered all the correct steps with these marker interfaces. By the look of it, this PR is just updating all of the steps which previously implemented the Mutating interface which in theory is sufficient. I wonder though if some consideration should be given into adding these markers to io() and possibly call() as well.

Also I wanted to ask if the findPossibleTraversalStepsForModulatorOperators() test is necessary as it appears to me that all of those modulators should already be tested by findPossibleTraversalSteps(). It is possible I'm misunderstanding this though so please correct me if I'm wrong.

@phanindhra876
Copy link
Contributor Author

phanindhra876 commented Apr 19, 2023

Intention of test findPossibleTraversalSteps is to check if we have covered all the symbols defined in the map or not. We don't do any checks whether the symbol is associated with any Step or not. To avoid over complicating the test, i have created another test to check for emptyness of ModulatingOperators.

@phanindhra876
Copy link
Contributor Author

I wonder though if some consideration should be given into adding these markers to io() and possibly call() as well.

For the scope of this PR, i have updated steps extending Mutating to implement Writing or Deleting or both. However, IoStep and CallStep does not implement Mutating step and i need to spend some time to understand how to update them. Maybe that can be added in a separate PR? I will work with Stephen to figure this out.

@spmallette
Copy link
Contributor

Writing and Deleting aren't really marker interface only, because Mutating isn't. Mutating brings with it the Event subsystem for EventStrategy. I don't think that will work well with io() or call(). I think that providers will just need to account for those steps as special cases rather than test them for Writing or Deleting. for example analyzing call() bytecode might require the additional check of examining the service being called for that step to determine its action. so, long story short, it was good to call those steps out, but i don't think they can implement any part of the Mutating interface the way it is defined. VOTE +1

@Cole-Greer
Copy link
Contributor

Intention of test findPossibleTraversalSteps is to check if we have covered all the symbols defined in the map or not. We don't do any checks whether the symbol is associated with any Step or not. To avoid over complicating the test, i have created another test to check for emptyness of ModulatingOperators.

I see, I had missed that the second test is asserting an empty list. Those tests look good to me. I agree with Stephen's analysis of io() and call() as well. Thanks for submitting these changes, they look good to me. VOTE +1 (Non-binding).

@kenhuuu
Copy link
Contributor

kenhuuu commented Apr 20, 2023

Do you mind squashing your commits and force pushing? Our current policy is to have the author do this rather than the person merging. Thanks.

@phanindhra876

This comment was marked as off-topic.

…utating steps to extend new interfaces

Capture possible steps populated by graph traversal for a graph operator

PR: apache#2025
@phanindhra876
Copy link
Contributor Author

@kenhuuu Squashed all commits into one commit.

Copy link

@saikiranboga saikiranboga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@xiazcy
Copy link
Contributor

xiazcy commented Apr 20, 2023

VOTE +1.
I've created a JIRA here for tacking purposes: https://issues.apache.org/jira/browse/TINKERPOP-2929.

@xiazcy xiazcy merged commit 650346b into apache:3.6-dev Apr 20, 2023
@phanindhra876 phanindhra876 deleted the step_map_3.6-dev branch April 21, 2023 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants