[ 
https://issues.apache.org/jira/browse/TINKERPOP-3080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17877107#comment-17877107
 ] 

ASF GitHub Bot commented on TINKERPOP-3080:
-------------------------------------------

Cole-Greer commented on code in PR #2616:
URL: https://github.com/apache/tinkerpop/pull/2616#discussion_r1733252401


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Operator.java:
##########
@@ -113,6 +133,11 @@ public Object apply(final Object a, final Object b) {
         public Object apply(final Object a, final Object b) {
             return b;
         }
+
+        @Override
+        public boolean isCommutative() {

Review Comment:
   I believe assignment should be non-commutative.



##########
gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Aggregate.feature:
##########
@@ -144,145 +144,435 @@ Feature: Step - aggregate()
   Scenario: g_V_aggregateXlocal_a_nameX_out_capXaX
     Given the modern graph
     And the traversal of
-      """
-      g.V().aggregate(Scope.local,"a").by("name").out().cap("a")
-      """
+    """
+    g.V().aggregate(Scope.local,"a").by("name").out().cap("a")
+    """
     When iterated next
     Then the result should be unordered
-      | result |
-      | marko |
-      | vadas |
-      | lop |
-      | josh |
-      | ripple |
-      | peter  |
+    | result |
+    | marko |
+    | vadas |
+    | lop |
+    | josh |
+    | ripple |
+    | peter  |
 
   Scenario: 
g_VX1X_aggregateXlocal_aX_byXnameX_out_aggregateXlocal_aX_byXnameX_name_capXaX
     Given the modern graph
     And using the parameter vid1 defined as "v[marko].id"
     And the traversal of
-      """
-      
g.V(vid1).aggregate(Scope.local,"a").by("name").out().aggregate(Scope.local,"a").by("name").values("name").cap("a")
-      """
+    """
+    
g.V(vid1).aggregate(Scope.local,"a").by("name").out().aggregate(Scope.local,"a").by("name").values("name").cap("a")
+    """
     When iterated next
     Then the result should be unordered
-      | result |
-      | marko |
-      | vadas |
-      | lop |
-      | josh |
+    | result |
+    | marko |
+    | vadas |
+    | lop |
+    | josh |
 
   Scenario: g_withSideEffectXa_setX_V_both_name_aggregateXlocal_aX_capXaX
     Given the modern graph
     And using the parameter xx1 defined as "s[]"
     And the traversal of
-      """
-      g.withSideEffect("a", 
xx1).V().both().values("name").aggregate(Scope.local,"a").cap("a")
-      """
+    """
+    g.withSideEffect("a", 
xx1).V().both().values("name").aggregate(Scope.local,"a").cap("a")
+    """
     When iterated next
     Then the result should be unordered
-      | result |
-      | marko |
-      | vadas |
-      | lop |
-      | josh |
-      | ripple |
-      | peter  |
+    | result |
+    | marko |
+    | vadas |
+    | lop |
+    | josh |
+    | ripple |
+    | peter  |
 
   Scenario: 
g_V_aggregateXlocal_aX_byXoutEXcreatedX_countX_out_out_aggregateXlocal_aX_byXinEXcreatedX_weight_sumX
     Given the modern graph
     And the traversal of
-      """
-      g.V().aggregate(Scope.local,"a").
-             by(__.outE("created").count()).
-        out().out().aggregate(Scope.local,"a").
-                      by(__.inE("created").values("weight").sum()).
-        cap("a")
-      """
+    """
+    g.V().aggregate(Scope.local,"a").
+    by(__.outE("created").count()).
+    out().out().aggregate(Scope.local,"a").
+    by(__.inE("created").values("weight").sum()).
+    cap("a")
+    """
     When iterated next
     Then the result should be unordered
-      | result |
-      | d[1].l |
-      | d[1].l |
-      | d[0].l |
-      | d[0].l |
-      | d[0].l |
-      | d[2].l |
-      | d[1.0].d |
-      | d[1.0].d |
+    | result |
+    | d[1].l |
+    | d[1].l |
+    | d[0].l |
+    | d[0].l |
+    | d[0].l |
+    | d[2].l |
+    | d[1.0].d |
+    | d[1.0].d |
 
   Scenario: g_V_aggregateXxX_byXvaluesXageX_isXgtX29XXX_capXxX
     Given the modern graph
     And the traversal of
-      """
-      g.V().aggregate("x").by(__.values("age").is(P.gt(29))).cap("x")
-      """
+    """
+    g.V().aggregate("x").by(__.values("age").is(P.gt(29))).cap("x")
+    """
     When iterated next
     Then the result should be unordered
-      | result |
-      | d[32].i |
-      | d[35].i |
+    | result |
+    | d[32].i |
+    | d[35].i |
 
   @WithProductiveByStrategy
   Scenario: 
g_withStrategiesXProductiveByStrategyX_V_aggregateXxX_byXvaluesXageX_isXgtX29XXX_capXxX
     Given the modern graph
     And the traversal of
-      """
-      
g.withStrategies(ProductiveByStrategy).V().aggregate("x").by(__.values("age").is(P.gt(29))).cap("x")
-      """
+    """
+    
g.withStrategies(ProductiveByStrategy).V().aggregate("x").by(__.values("age").is(P.gt(29))).cap("x")
+    """
     When iterated next
     Then the result should be unordered
-      | result |
-      | d[32].i |
-      | d[35].i |
-      | null |
-      | null |
-      | null |
-      | null |
+    | result |
+    | d[32].i |
+    | d[35].i |
+    | null |
+    | null |
+    | null |
+    | null |
 
   @GraphComputerVerificationStarGraphExceeded
   Scenario: g_V_aggregateXxX_byXout_order_byXnameXX_capXxX
     Given the modern graph
     And the traversal of
-      """
-      g.V().aggregate("x").by(__.out().order().by("name")).cap("x")
-      """
+    """
+    g.V().aggregate("x").by(__.out().order().by("name")).cap("x")
+    """
     When iterated next
     Then the result should be unordered
-      | result |
-      | v[josh] |
-      | v[lop] |
-      | v[lop] |
+    | result |
+    | v[josh] |
+    | v[lop] |
+    | v[lop] |
 
   @GraphComputerVerificationReferenceOnly @WithProductiveByStrategy
   Scenario: 
g_withStrategiesXProductiveByStrategyX_V_aggregateXxX_byXout_order_byXnameXX_capXxX
     Given the modern graph
     And the traversal of
-      """
-      
g.withStrategies(ProductiveByStrategy).V().aggregate("x").by(__.out().order().by("name")).cap("x")
-      """
+    """
+    
g.withStrategies(ProductiveByStrategy).V().aggregate("x").by(__.out().order().by("name")).cap("x")
+    """
     When iterated next
     Then the result should be unordered
-      | result |
-      | v[josh] |
-      | v[lop] |
-      | v[lop] |
-      | null |
-      | null |
-      | null |
+    | result |
+    | v[josh] |
+    | v[lop] |
+    | v[lop] |
+    | null |
+    | null |
+    | null |
 
   Scenario: 
g_V_aggregateXaX_hasXperson_age_gteX30XXX_capXaX_unfold_valuesXnameX
     Given the modern graph
     And the traversal of
-      """
-      g.V().aggregate("a").has("person","age", 
P.gte(30)).cap("a").unfold().values("name")
-      """
+    """
+    g.V().aggregate("a").has("person","age", 
P.gte(30)).cap("a").unfold().values("name")
+    """
+    When iterated to list
+    Then the result should be unordered
+    | result |
+    | marko |
+    | josh |
+    | peter |
+    | lop |
+    | vadas |
+    | ripple |
+
+  Scenario: g_withSideEffectXa_1_sumX_V_aggregateXaX_byXageX_capXaX
+    Given the modern graph
+    And the traversal of
+    """
+    g.withSideEffect("a", 1, 
Operator.sum).V().aggregate("a").by("age").cap("a")
+    """
+    When iterated to list
+    Then the result should be unordered
+    | result   |
+    | d[124].i |
+
+  Scenario: g_withSideEffectXa_1_sumX_V_aggregateXlocal_aX_byXageX_capXaX
+    Given the modern graph
+    And the traversal of
+    """
+    g.withSideEffect("a", 1, Operator.sum).V().aggregate(Scope.local, 
"a").by("age").cap("a")
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result   |
+      | d[124].i |
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_withSideEffectXa_123_minusX_V_aggregateXaX_byXageX_capXaX
+    Given the modern graph
+    And the traversal of
+    """
+    g.withSideEffect("a", 123, 
Operator.minus).V().aggregate("a").by("age").cap("a")
+    """
+    When iterated to list
+    Then the result should be unordered
+    | result |
+    | d[0].i |
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_withSideEffectXa_123_minusX_V_aggregateXlocal_aX_byXageX_capXaX
+    Given the modern graph
+    And the traversal of
+    """
+    g.withSideEffect("a", 123, Operator.minus).V().aggregate(Scope.local, 
"a").by("age").cap("a")
+    """
     When iterated to list
     Then the result should be unordered
       | result |
-      | marko |
-      | josh |
-      | peter |
-      | lop |
-      | vadas |
-      | ripple |
\ No newline at end of file
+      | d[0].i |
+
+  Scenario: g_withSideEffectXa_2_multX_V_aggregateXaX_byXageX_capXaX
+    Given the modern graph
+    And the traversal of
+    """
+    g.withSideEffect("a", 2, 
Operator.mult).V().aggregate("a").by("age").cap("a")
+    """
+    When iterated to list
+    Then the result should be unordered
+    | result |
+    | d[1753920].i |
+
+  Scenario: g_withSideEffectXa_2_multX_V_aggregateXlocal_aX_byXageX_capXaX
+    Given the modern graph
+    And the traversal of
+    """
+    g.withSideEffect("a", 2, Operator.mult).V().aggregate(Scope.local, 
"a").by("age").cap("a")
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | d[1753920].i |
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_withSideEffectXa_876960_divX_V_aggregateXaX_byXageX_capXaX
+    Given the modern graph
+    And the traversal of
+    """
+    g.withSideEffect("a", 876960, 
Operator.div).V().aggregate("a").by("age").cap("a")
+    """
+    When iterated to list
+    Then the result should be unordered
+    | result |
+    | d[1].i |
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_withSideEffectXa_876960_divX_V_aggregateXlocal_aX_byXageX_capXaX

Review Comment:
   Are these scenarios intended to be excluded for GraphComputer? If so, 
perhaps a different tag should be used as these scenarios do not use `inject` 
step.
   
   https://tinkerpop.apache.org/docs/current/dev/developer/#gherkin-tags





> AggregateStep can support all Operators predefined in TinkerPop
> ---------------------------------------------------------------
>
>                 Key: TINKERPOP-3080
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3080
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: language, process
>            Reporter: Norio Akagi
>            Priority: Major
>             Fix For: 3.7.3
>
>
> Currently, {{AggreteGlobalStep}} and {{AggreteLocalStep}} only support addAll 
> and assign as Operator. This is because they use BulkSet to apply to 
> Operator. Only addAll and assign can work with BulkSet, so for other 
> operators it results in a type casting failure.
> They can be more flexible to work with any operators depending on what is set 
> by {{{}withSideEffect(){}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to