replikativ / hitchhiker-tree

Functional, persistent, off-heap, high performance data structure
Eclipse Public License 1.0
44 stars 19 forks source link

Implement IKeyCompare for UUIDs #7

Closed purrgrammer closed 4 years ago

purrgrammer commented 4 years ago

The default comparison function for java.util.UUID does not do an unsigned comparison as it should, which is an acknowledged bug that won't be fixed https://bugs.java.com/bugdatabase/view_bug.do?bug_id=7025832

This commit implements unsigned comparison for java.util.UUID types.

whilo commented 4 years ago

That looks good to me. Can you add a version with the same behavior for cljs? We are trying to stay compatible so that we will be able to port the datahike frontend to cljs over distributed indices in the longer run.

purrgrammer commented 4 years ago

IIUC the default comparison in CLJS uses the lexicographical comparison of the (lowercased) UUID string so it should be equivalent. I needed to add compare-uuid for the JVM because the default ordering for java.util.UUID is broken.

whilo commented 4 years ago

Nice work, thanks. I have put a new 0.1.5-SNAPSHOT release on clojars. If you need a stable release, please open an issue.