[
https://issues.apache.org/jira/browse/TINKERPOP-2423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Saikiran Boga updated TINKERPOP-2423:
-------------------------------------
Description:
The {{hashCode computation}} for PropertiesStep collides for multiple steps
when there are repeating keys. For example {{.properties()}} and
{{.properties("a","a")}}, {{.properties("a")}} and .{{properties("a","b","b")}}
have the same hash code because of xor of just properties here
[https://github.com/apache/tinkerpop/blob/cff4c161615f2b50bda27b6ba523c7f52b833532/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java#L80-L87].
Basically, the even keys cancel out the xor computation.
The same is also true for {{AbstractStep.hashCode}} which takes xor of labels.
{{GraphStep}} does the same thing using ids. so {{g.V("1", "1")}} and {{g.V()}}
would collide during comparison.
was:
The {{hashCode computation}} for PropertiesStep collides for multiple steps
when there are repeating keys. For example {{.properties()}} and
{{.properties("a","a")}}, {{.properties("a")}} and .{{properties("a","b","b")}}
have the same hash code because of xor of just properties here
[https://github.com/apache/tinkerpop/blob/cff4c161615f2b50bda27b6ba523c7f52b833532/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java#L80-L87].
Basically, the even keys cancel out the xor computation.
The same is also true for {{AbstractStep.hashCode}} which takes xor of labels.
{{}}
{{GraphStep}} does the same thing using ids. so {{g.V("1", "1")}} and {{g.V()}}
would collide during comparison.
> hashCode collision for steps with different attributes
> ------------------------------------------------------
>
> Key: TINKERPOP-2423
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2423
> Project: TinkerPop
> Issue Type: Bug
> Components: server
> Reporter: Saikiran Boga
> Priority: Major
>
> The {{hashCode computation}} for PropertiesStep collides for multiple steps
> when there are repeating keys. For example {{.properties()}} and
> {{.properties("a","a")}}, {{.properties("a")}} and
> .{{properties("a","b","b")}} have the same hash code because of xor of just
> properties here
> [https://github.com/apache/tinkerpop/blob/cff4c161615f2b50bda27b6ba523c7f52b833532/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java#L80-L87].
> Basically, the even keys cancel out the xor computation.
>
> The same is also true for {{AbstractStep.hashCode}} which takes xor of labels.
> {{GraphStep}} does the same thing using ids. so {{g.V("1", "1")}} and
> {{g.V()}} would collide during comparison.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)