-
Notifications
You must be signed in to change notification settings - Fork 789
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
[TINKERPOP-3080] AggregateGlobalStep accepts all pre-defined Operators #2616
base: 3.7-dev
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 3.7-dev #2616 +/- ##
=============================================
+ Coverage 76.14% 80.50% +4.35%
=============================================
Files 1084 27 -1057
Lines 65160 5000 -60160
Branches 7285 0 -7285
=============================================
- Hits 49616 4025 -45591
+ Misses 12839 773 -12066
+ Partials 2705 202 -2503 ☔ View full report in Codecov by Sentry. |
1fab0ae
to
050f77b
Compare
|
||
// Pre-defined Operator such as addAll and assign will reduce over the whole input set, rather than | ||
// applying a single input one by one. | ||
final boolean isOperatorForBulkSet = sideEffects.getReducer(sideEffectKey) == Operator.addAll || |
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.
nit: suggest renaming this to bulkReducingOperator
or something similar to callout observation towards the nature of reducing operators instead of limiting to BulkSet. addAll works with either maps or any collection and assign works with any type of input.
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.
Thanks Norio for the change. Looks good overall. Few nits.
// Pre-defined Operator such as addAll and assign will reduce over the whole input set, rather than | ||
// applying a single input one by one. |
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.
Suggest to also add to comment here on how both these operators work to be clear on why we focus on reduction over the whole input set. Basically, addAll
can only work when either inputs to it are Maps or instances of Collection interface. And assign
works for any type of input.
final TraversalSideEffects sideEffects = this.getTraversal().getSideEffects(); | ||
// Pre-defined Operator such as addAll and assign will reduce over the whole input set, rather than | ||
// applying a single input one by one. | ||
final boolean isOperatorForBulkSet = sideEffects.getReducer(sideEffectKey) == Operator.addAll || | ||
sideEffects.getReducer(sideEffectKey) == Operator.assign; | ||
|
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.
Same suggestions here as changes from AggregateGlobalStep.
|
||
if (step instanceof SideEffectCapable) { | ||
final BinaryOperator<?> sideEffectOperator = traversal.getSideEffects().getReducer(((SideEffectCapable<?, ?>) step).getSideEffectKey()); | ||
if (sideEffectOperator instanceof Operator && (!((Operator) sideEffectOperator).isCommutative())) { | ||
throw new VerificationException("The following step has an SideEffect operator " + sideEffectOperator + " which is currently not supported on GraphComputer: " + step, traversal); | ||
} | ||
} |
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.
Curious, what was the issue here?
Support all Operators in AggregateGlobalStep and AggregateLocalStep.
https://issues.apache.org/jira/browse/TINKERPOP-3080