Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example that clarifies the effects of dedup having global scope #252

Open
krlawrence opened this issue Apr 1, 2023 · 0 comments
Open

Comments

@krlawrence
Copy link
Owner

krlawrence commented Apr 1, 2023

Cases like this can be confusing to Gremlin users

gremlin> g.V(3).out().out().count()
==>7858
gremlin> g.V(3).out().out().dedup().count()
==>992
gremlin> g.V(4).out().out().count()
==>6817 
gremlin> g.V(4).out().out().dedup().count()
==>812
gremlin> g.V(3,4).as('a').out().out().group().by(select('a').id()).by(count())
==>[3:7858,4:6817]
gremlin> g.V(3,4).as('a').out().out().dedup().group().by(select('a').id()).by(count())
==>[3:992]  

Once dedup is added the second "a traverser" is only going to get the leftovers. In cases where every vertex is common across each traverser, the second traverser is left with nothing. To fix this requires adding some local scope to part of the query.

gremlin> g.V(3,4).as('a').local(out().out().dedup()).group().by(select('a').id()).by(count())
==>[3:992,4:812]  
@krlawrence krlawrence self-assigned this Apr 1, 2023
@krlawrence krlawrence added this to New issues in Planning via automation Apr 1, 2023
@krlawrence krlawrence moved this from New issues to Medium Priority in Planning Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Planning
  
Medium Priority
Development

No branches or pull requests

1 participant