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

feat: Implement GEOADD and GEODIST commands #947

Merged

Conversation

KaviiSuri
Copy link
Contributor

@KaviiSuri KaviiSuri commented Oct 4, 2024

  1. This PR refactors ZADD and ZRANGE implementation into the sortedset package, allowing use in other commands
  2. This PR introduces GEOADD and GEODIST commands, that use geohash (from github.com/mmcloughlin/geohash) and sorted set implementation to implement geo spatial indexes.
  3. This PR also introduces the geo package that contains geospatial calculations and abstracts the library so we can modify/swap it out later.

NOTE: for the sake of being consistent with redis, i've set the geohash precision to 52 bits, it kinda seems wasteful since we anyway store 64 bites. Do you think it's better to use all 64 bits? doing so will make our distances a bit different from redis output (in my tests about 0.128% -> 20cm in 166 KM)

@KaviiSuri KaviiSuri force-pushed the kavii/geohash-implementation branch from 12f0d7b to 280f7c1 Compare October 4, 2024 08:16
@KaviiSuri KaviiSuri force-pushed the kavii/geohash-implementation branch from 280f7c1 to 5b6d4d7 Compare October 4, 2024 08:18
@JyotinderSingh JyotinderSingh self-requested a review October 4, 2024 15:35
@JyotinderSingh
Copy link
Collaborator

Let's keep our calculations consistent with redis for now.

Copy link
Collaborator

@JyotinderSingh JyotinderSingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this massive effort @KaviiSuri! The changes look well written and well tested. LGTM

@JyotinderSingh JyotinderSingh merged commit 3d2283e into DiceDB:master Oct 5, 2024
2 checks passed
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.

2 participants