You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Daniel Kuppitz (JIRA)" <ji...@apache.org> on 2017/08/07 15:04:00 UTC
[jira] [Created] (TINKERPOP-1741) GroupStep's on-the-fly reducer is
a bit screwy
Daniel Kuppitz created TINKERPOP-1741:
-----------------------------------------
Summary: GroupStep's on-the-fly reducer is a bit screwy
Key: TINKERPOP-1741
URL: https://issues.apache.org/jira/browse/TINKERPOP-1741
Project: TinkerPop
Issue Type: Bug
Components: process
Affects Versions: 3.2.5
Reporter: Daniel Kuppitz
Assignee: Marko A. Rodriguez
Without {{dedup():}}
{noformat}
gremlin> g.V().both().has("age").group("a").by("age").by(values("name").fold()).barrier().select("a").limit(1)
==>[32:[josh,josh,josh],35:[peter],27:[vadas],29:[marko,marko,marko]]
{noformat}
With {{dedup()}}:
{noformat}
gremlin> g.V().both().has("age").group("a").by("age").by(values("name").dedup().fold()).barrier().select("a").limit(1)
==>[32:[josh:josh],35:[peter:peter],27:[vadas:vadas],29:[marko:marko]]
{noformat}
Why do the values end up being maps? That's pretty unexpected.
As a workaround we can do this:
{noformat}
gremlin> g.withSideEffect("a", [:].withDefault {[] as Set}).V().both().has("age").group("a").by("age").by(values("name").fold()).barrier().select("a").limit(1)
==>[27:[vadas],32:[josh],29:[marko],35:[peter]]
{noformat}
Also note, that {{cap()}} behaves correctly, even though we're using {{dedup()}}:
{noformat}
gremlin> g.V().both().has("age").group("a").by("age").by(values("name").dedup().fold()).barrier().cap("a")
==>[32:[josh],35:[peter],27:[vadas],29:[marko]]
{noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)