[ https://issues.apache.org/jira/browse/TINKERPOP-3150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17946188#comment-17946188 ]
ASF GitHub Bot commented on TINKERPOP-3150: ------------------------------------------- andreachild commented on code in PR #3093: URL: https://github.com/apache/tinkerpop/pull/3093#discussion_r2052751740 ########## gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/filter/Sample.feature: ########## @@ -18,6 +18,15 @@ @StepClassFilter @StepSample Feature: Step - sample() + Scenario: g_V_sampleX1X_byXageX_byXT_idX + Given the modern graph + And the traversal of + """ + g.V().sample(1).by("age").by(T.id) + """ + When iterated to list + Then the traversal will raise an error Review Comment: Now that https://github.com/apache/tinkerpop/pull/3094 is merged you should be able to do this: ``` Scenario: g_V_sampleX1X_byXageX_byXT_idX Given the modern graph And the traversal of """ g.V().sample(1).by("age").by(T.id) """ Then the traversal will raise an error with message containing text of "Sample step can only have one by modulator" ``` > Prevent sample step from having multiple by modulators > ------------------------------------------------------ > > Key: TINKERPOP-3150 > URL: https://issues.apache.org/jira/browse/TINKERPOP-3150 > Project: TinkerPop > Issue Type: Improvement > Components: process > Affects Versions: 3.7.3 > Reporter: Andrea C > Priority: Minor > > Sample step will ignore previous by modulators if multiple are specified, > which can be misleading to the user. Instead, similar to > https://issues.apache.org/jira/browse/TINKERPOP-3121 multiple by modulators > should be prevented with sample. > {code:java} > gremlin> g.V().sample(10).by(id).elementMap() > ==>[id:1,label:person,name:marko,age:29] > ==>[id:2,label:person,name:vadas,age:27] > ==>[id:3,label:software,name:lop,lang:java] > ==>[id:4,label:person,name:josh,age:32] > ==>[id:5,label:software,name:ripple,lang:java] > ==>[id:6,label:person,name:peter,age:35] > gremlin> g.V().sample(10).by('age').elementMap() > ==>[id:1,label:person,name:marko,age:29] > ==>[id:2,label:person,name:vadas,age:27] > ==>[id:4,label:person,name:josh,age:32] > ==>[id:6,label:person,name:peter,age:35] > gremlin> g.V().sample(10).by('age').by(id).elementMap() > ==>[id:1,label:person,name:marko,age:29] > ==>[id:2,label:person,name:vadas,age:27] > ==>[id:3,label:software,name:lop,lang:java] > ==>[id:4,label:person,name:josh,age:32] > ==>[id:5,label:software,name:ripple,lang:java] > ==>[id:6,label:person,name:peter,age:35]{code} -- This message was sent by Atlassian Jira (v8.20.10#820010)