Skip to content

TINKERPOP-3232 Coerce set into list when it contains non-hashable elements#3359

Merged
xiazcy merged 1 commit into3.7-devfrom
TINKERPOP-3232
Mar 30, 2026
Merged

TINKERPOP-3232 Coerce set into list when it contains non-hashable elements#3359
xiazcy merged 1 commit into3.7-devfrom
TINKERPOP-3232

Conversation

@xiazcy
Copy link
Copy Markdown
Contributor

@xiazcy xiazcy commented Mar 25, 2026

https://issues.apache.org/jira/browse/TINKERPOP-3232

Originally thought of using HashableDict, but ended up with deserializing into list instead due to potential hash collision and silent mutations of nested objects. Given gremlin-go also uses lists to back its custom set type, this wouldn't be an exclusion. Also this best preserves the inner data and type, which is usually what users operate on.

However, I did keep a commit with the HashableDict.of() in case we favor that solution instead. Note there could be an improvement to this, where we use frozenset for set instead of tuple in the HashableDict implementation.

(I will add CHANGELOG entry after the decision is made on the approach.)

CHANGELOG added in favor of deserializing into list to minimize changes to inner results.

VOTE +1

@Cole-Greer
Copy link
Copy Markdown
Contributor

VOTE +1

@GumpacG
Copy link
Copy Markdown

GumpacG commented Mar 29, 2026

Could you add to the docs for limitation

* Traversals that return a `Set` *might* be coerced to a `List` in Python. In the case of Python, number equality
?
Seems like it's already a known limitation, would be nice to specify for non-hashable elements as well.

@kenhuuu
Copy link
Copy Markdown
Contributor

kenhuuu commented Mar 30, 2026

VOTE +1

@xiazcy xiazcy merged commit 47a555b into 3.7-dev Mar 30, 2026
71 of 72 checks passed
@xiazcy xiazcy deleted the TINKERPOP-3232 branch March 30, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants