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

Andrea C edited comment on TINKERPOP-3121 at 4/3/25 9:23 PM:
-------------------------------------------------------------

GroupCountStep only has one `keyTraversal` which is essentially replaced when 
multiple `by()` modulators are used. In the given example the output is 
determined by the last `by()` modulator.

A fix could involve changing GroupCountStep to use a `TraversalRing` for its 
`keyTraversal`, essentially supporting multiple `by()` modulators instead of 
just one.

Another approach is to prevent multiple by operators by throwing an 
`IllegalStateException`.

Other steps which should also be looked into for a similar issue as they 
currently are ByModulating but only track one by modulating traversal:
 * aggregate
 * dedup
 * sack
 * sample
 * select (one, traversal)
 ** depending on the select step arguments, multiple by modulators may be 
supported - for consistency, no select steps should throw an exception if other 
select steps support it


was (Author: JIRAUSER308356):
GroupCountStep only has one `keyTraversal` which is essentially replaced when 
multiple `by()` modulators are used. In the given example the output is 
determined by the last `by()` modulator.

A fix could involve changing GroupCountStep to use a `TraversalRing` for its 
`keyTraversal`, essentially supporting multiple `by()` modulators instead of 
just one.

Another approach is to prevent multiple by operators by throwing an 
`IllegalStateException`.

Other steps which should also be looked into for a similar issue as they 
currently are ByModulating but only track one by modulating traversal:
 * aggregate
 * dedup
 * sack
 * sample
 * select (one, traversal)

> Multiple by() modulators lead to unexpected behavior
> ----------------------------------------------------
>
>                 Key: TINKERPOP-3121
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3121
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.6.7
>            Reporter: Stephen Mallette
>            Priority: Minor
>
> {code}
> gremlin> g.V().out().groupCount().by('lang')
> ==>[java:4]
> gremlin> g.V().out().groupCount().by('lang').by('age')
> ==>[32:1,27:1]
> gremlin> g.V().out().groupCount().by('age')
> ==>[32:1,27:1]
> gremlin> g.V().out().groupCount().by('lang').by('age').by('lang')
> ==>[java:4]
> {code}
> This might be an issue for other steps beyond {{groupCount()}}.



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

Reply via email to