Skip to content

Issue/dataredis 438 - Add support for geo commands #187

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

Closed
wants to merge 18 commits into from

Conversation

nsdiv
Copy link
Contributor

@nsdiv nsdiv commented Apr 3, 2016

Added the following classes: RedisGeoCommands, GeoOperations, DefaultGeoOperations, BoundGeoOperations, DefaultBoundGeoOperations

Added the following methods to RedisGeoCommands
Long geoAdd(byte[] key, double longitude, double latitude, byte[] member);
Long geoAdd(byte[] key, Map<byte[], GeoCoordinate> memberCoordinateMap);
Double geoDist(byte[] key, byte[] member1, byte[] member2);
Double geoDist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit);
List<byte[]> geoHash(byte[] key, byte[]... members);
List geoPos(byte[] key, byte[]... members);
List georadius(byte[] key, double longitude, double latitude,
double radius, GeoUnit unit);
List georadius(byte[] key, double longitude, double latitude,
double radius, GeoUnit unit, GeoRadiusParam param);
List georadiusByMember(byte[] key, byte[] member, double radius,
GeoUnit unit);
List georadiusByMember(byte[] key, byte[] member, double radius,
GeoUnit unit, GeoRadiusParam param);
Long geoRemove(byte[] key, byte[]... values);

@christophstrobl
Copy link
Member

thanks @nsdiv for all the hard work. We're in the home stretch for the Hopper release. This one is scheduled for the next release train. If you have not done so yet please sign the CLA and add your confirmation number either to this PR or DATAREDIS-438.

BTW if you want to bump the Redis version for CI build just alter REDIS_VERSION:=3.0.7 in Makefile.

@nsdiv
Copy link
Contributor Author

nsdiv commented Apr 7, 2016

@christophstrobl I see the following tests are failing, however I'm at a loss as to why that is happening. I can see this error happening earlier versions of the code as well, on my local. The keys from getConfig are
[127.0.0.1:7380.hash-max-ziplist-entries, 512, 127.0.0.1:7380.set-max-intset-entries, 512, 127.0.0.1:7380.zset-max-ziplist-entries, 128, 127.0.0.1:7381.hash-max-ziplist-entries, 512, 127.0.0.1:7381.set-max-intset-entries, 512, 127.0.0.1:7381.zset-max-ziplist-entries, 128, 127.0.0.1:7379.hash-max-ziplist-entries, 512, 127.0.0.1:7379.set-max-intset-entries, 512, 127.0.0.1:7379.zset-max-ziplist-entries, 128]

`Tests run: 186, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.669 sec <<< FAILURE! - in org.springframework.data.redis.connection.jedis.JedisClusterConnectionTests
getConfigShouldLoadCumulatedConfiguration(org.springframework.data.redis.connection.jedis.JedisClusterConnectionTests) Time elapsed: 0.033 sec <<< FAILURE!
java.lang.AssertionError:

Expected: is <24>
but: was <18>
at org.springframework.data.redis.connection.jedis.JedisClusterConnectionTests.getConfigShouldLoadCumulatedConfiguration(JedisClusterConnectionTests.java:2294)`
Running org.springframework.data.redis.connection.lettuce.LettuceClusterConnectionTests
Tests run: 186, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 7.2 sec <<< FAILURE! - in org.springframework.data.redis.connection.lettuce.LettuceClusterConnectionTests
getConfigShouldLoadCumulatedConfiguration(org.springframework.data.redis.connection.lettuce.LettuceClusterConnectionTests) Time elapsed: 0.061 sec <<< FAILURE!
java.lang.AssertionError:

Expected: is <24>
but: was <18>
at org.springframework.data.redis.connection.lettuce.LettuceClusterConnectionTests.getConfigShouldLoadCumulatedConfiguration(LettuceClusterConnectionTests.java:2279)

@mp911de
Copy link
Member

mp911de commented Apr 8, 2016

@nsdiv The test error is related to the new Redis version. CONFIG GET *max-*-entries on Redis 3.0.7 returns:

127.0.0.1:7379> config get *max-*-entries
1) "hash-max-ziplist-entries"
2) "512"
3) "list-max-ziplist-entries"
4) "512"
5) "set-max-intset-entries"
6) "512"
7) "zset-max-ziplist-entries"
8) "128"

and Redis unstable (the 3.2 branch):

127.0.0.1:7379> config get *max-*-entries
1) "hash-max-ziplist-entries"
2) "512"
3) "set-max-intset-entries"
4) "512"
5) "zset-max-ziplist-entries"
6) "128"

I'd propose to change the assertion to assertThat(result.size() % 6, is(0)) because the thing we want to validate is whether the config from all three nodes is loaded. 6 because we have 3 nodes and each config entry consists of a key and a value, so 3 nodes * 2 (key/value pair) * 3 resulting entries = 18 in this case.

…hile on 3.2.0-rc3 returns 6. applying mp911de's suggestion to get a mod of 6
@nsdiv
Copy link
Contributor Author

nsdiv commented Apr 8, 2016

Thanks for the comment @mp911de . The tests pass now. Looking forward to getting this into a release.

@nsdiv
Copy link
Contributor Author

nsdiv commented Apr 11, 2016

CLA - 169220160326121428, Name - Ninad Divadkar

@nsdiv
Copy link
Contributor Author

nsdiv commented May 11, 2016

Hi @christophstrobl Just wanted to make sure you're aware of this pull request.

@christophstrobl
Copy link
Member

thanks @nsdiv - yes I am 😄

christophstrobl pushed a commit that referenced this pull request May 17, 2016
Original Pulll Request: #187
CLA: 169220160326121428 (Ninad Divadkar)
christophstrobl added a commit that referenced this pull request May 17, 2016
RedisGeoCommands now take and return Spring Data domain types like Distance and GeoResults.
Updated JavaDoc and Reference documentation.
Added and updated author and license headers.
Fixed minor formatting and code style issues.
 

Original Pulll Request: #187
christophstrobl added a commit that referenced this pull request May 17, 2016
RedisGeoCommands now take and return Spring Data domain types like Distance and GeoResults.
Updated JavaDoc and Reference documentation.
Added and updated author and license headers.
Fixed minor formatting and code style issues.
 

Original Pulll Request: #187
christophstrobl added a commit that referenced this pull request May 17, 2016
RedisGeoCommands now take and return Spring Data domain types like Distance and GeoResults.
Updated JavaDoc and Reference documentation.
Added and updated author and license headers.
Fixed minor formatting and code style issues.
 

Original Pulll Request: #187
christophstrobl added a commit that referenced this pull request May 18, 2016
RedisGeoCommands now take and return Spring Data domain types like Distance and GeoResults.
Updated JavaDoc and Reference documentation.
Added and updated author and license headers.
Fixed minor formatting and code style issues.
 

Original Pulll Request: #187
christophstrobl pushed a commit that referenced this pull request May 18, 2016
Original Pulll Request: #187
CLA: 169220160326121428 (Ninad Divadkar)
christophstrobl added a commit that referenced this pull request May 18, 2016
RedisGeoCommands now take and return Spring Data domain types like Distance and GeoResults.
Updated JavaDoc and Reference documentation.
Added and updated author and license headers.
Fixed minor formatting and code style issues.

Original Pulll Request: #187
@christophstrobl
Copy link
Member

Merged via b0e20d3. Thanks @nsdiv !

christophstrobl added a commit that referenced this pull request May 23, 2016
RedisGeoCommands now take and return Spring Data domain types like Distance and GeoResults.
Updated JavaDoc and Reference documentation.
Added and updated author and license headers.
Fixed minor formatting and code style issues.

Original Pulll Request: #187
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.

3 participants