[ https://issues.apache.org/jira/browse/TINKERPOP-3080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17876606#comment-17876606 ]
ASF GitHub Bot commented on TINKERPOP-3080: ------------------------------------------- rdtr commented on code in PR #2616: URL: https://github.com/apache/tinkerpop/pull/2616#discussion_r1730783208 ########## gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Aggregate.feature: ########## @@ -144,145 +144,490 @@ 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") + """ + 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 | + + + Scenario: g_withSideEffectXa_1_sumLongX_V_aggregateXaX_byXageX_capXaX + Given the empty graph + And the graph initializer of + # This graph is the same as ModernGraph, but ages are stored as Long. + """ + g.addV("person").property("name", "marko").property("age", 29L).as("marko"). + addV("person").property("name", "vadas").property("age", 27L).as("vadas"). + addV("software").property("name", "lop").property("lang", "java").as("lop"). + addV("person").property("name","josh").property("age", 32L).as("josh"). + addV("software").property("name", "ripple").property("lang", "java").as("ripple"). + addV("person").property("name", "peter").property("age", 35L).as('peter'). + addE("knows").from("marko").to("vadas").property("weight", 0.5d). + addE("knows").from("marko").to("josh").property("weight", 1.0d). + addE("created").from("marko").to("lop").property("weight", 0.4d). + addE("created").from("josh").to("ripple").property("weight", 1.0d). + addE("created").from("josh").to("lop").property("weight", 0.4d). + addE("created").from("peter").to("lop").property("weight", 0.2d) """ - g.V().aggregate("a").has("person","age", P.gte(30)).cap("a").unfold().values("name") + And the traversal of + """ + g.withSideEffect("a", 1L, Operator.sumLong).V().aggregate("a").by("age").cap("a") + """ + When iterated to list + Then the result should be unordered + | result | + | d[124].l | + + Scenario: g_withSideEffectXa_1_sumLongX_V_aggregateXlocal_aX_byXageX_capXaX + Given the empty graph + And the graph initializer of + # This graph is the same as ModernGraph, but ages are stored as Long. + """ + g.addV("person").property("name", "marko").property("age", 29L).as("marko"). Review Comment: OK I think it doesn't matter because when using `sumLong` operator, values are casted to `long` anyway. I will just use the regular Modern graph and see if the test passes. ########## gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/sideEffect/Aggregate.feature: ########## @@ -144,145 +144,490 @@ 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") + """ + 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 | + + + Scenario: g_withSideEffectXa_1_sumLongX_V_aggregateXaX_byXageX_capXaX + Given the empty graph + And the graph initializer of + # This graph is the same as ModernGraph, but ages are stored as Long. + """ + g.addV("person").property("name", "marko").property("age", 29L).as("marko"). + addV("person").property("name", "vadas").property("age", 27L).as("vadas"). + addV("software").property("name", "lop").property("lang", "java").as("lop"). + addV("person").property("name","josh").property("age", 32L).as("josh"). + addV("software").property("name", "ripple").property("lang", "java").as("ripple"). + addV("person").property("name", "peter").property("age", 35L).as('peter'). + addE("knows").from("marko").to("vadas").property("weight", 0.5d). + addE("knows").from("marko").to("josh").property("weight", 1.0d). + addE("created").from("marko").to("lop").property("weight", 0.4d). + addE("created").from("josh").to("ripple").property("weight", 1.0d). + addE("created").from("josh").to("lop").property("weight", 0.4d). + addE("created").from("peter").to("lop").property("weight", 0.2d) """ - g.V().aggregate("a").has("person","age", P.gte(30)).cap("a").unfold().values("name") + And the traversal of + """ + g.withSideEffect("a", 1L, Operator.sumLong).V().aggregate("a").by("age").cap("a") + """ + When iterated to list + Then the result should be unordered + | result | + | d[124].l | + + Scenario: g_withSideEffectXa_1_sumLongX_V_aggregateXlocal_aX_byXageX_capXaX + Given the empty graph + And the graph initializer of + # This graph is the same as ModernGraph, but ages are stored as Long. + """ + g.addV("person").property("name", "marko").property("age", 29L).as("marko"). + addV("person").property("name", "vadas").property("age", 27L).as("vadas"). + addV("software").property("name", "lop").property("lang", "java").as("lop"). + addV("person").property("name","josh").property("age", 32L).as("josh"). + addV("software").property("name", "ripple").property("lang", "java").as("ripple"). + addV("person").property("name", "peter").property("age", 35L).as('peter'). + addE("knows").from("marko").to("vadas").property("weight", 0.5d). + addE("knows").from("marko").to("josh").property("weight", 1.0d). + addE("created").from("marko").to("lop").property("weight", 0.4d). + addE("created").from("josh").to("ripple").property("weight", 1.0d). + addE("created").from("josh").to("lop").property("weight", 0.4d). + addE("created").from("peter").to("lop").property("weight", 0.2d) """ + And the traversal of + """ + g.withSideEffect("a", 1L, Operator.sumLong).V().aggregate(Scope.local, "a").by("age").cap("a") Review Comment: Same as above. > 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)