rdtr commented on code in PR #2616:
URL: https://github.com/apache/tinkerpop/pull/2616#discussion_r1643189640


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/ComputerVerificationStrategy.java:
##########
@@ -80,6 +78,13 @@ public void apply(final Traversal.Admin<?, ?> traversal) {
 
             if (UNSUPPORTED_STEPS.stream().filter(c -> 
c.isAssignableFrom(step.getClass())).findFirst().isPresent())
                 throw new VerificationException("The following step is 
currently not supported on GraphComputer: " + step, traversal);
+
+            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);
+                }
+            }

Review Comment:
   Without this, in GraphComputer test I see that the unit tests I added 
failed. It seems GraphComputer works like map-reduce so when we have input like 
`1,2,3,4,5,6` for example, they are split into small chunk and operator is 
applied. 
   
   So for example, let's say we have 3 hosts and data are split like `1, 6`, 
`2, 4`, and `3, 5`. With `ADD` it is fine because on each host the result would 
be `7`, `6`, and `8`. They are further summed up to 7 + 6 + 8 = 21 so the 
result is consistent.
   However, for `MINUS`, a result in each host would be `-5`, `-2`, and `-2` 
then -5 - (-2) - (-2) = -1. This is not what we want because what we expect to 
happen is 1 - 2 - 3 - 4 - 5 - 6. 
   
   I believe that we can still make it to work in distributed env with some 
tweak, but Stephen agreed to disable it for now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to