Skip to content

GEORADIUS WITHCOORD returns wrong coordinate on multiple results #805

@dittos

Description

@dittos

Bug Report

Current Behavior

GEORADIUS WITHCOORD returns wrong x coordinate starting from the second result.

Input Code

import io.lettuce.core.GeoArgs;
import io.lettuce.core.RedisClient;
import io.lettuce.core.RedisURI;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;

public class LettuceBugDemo {
    public static void main(String[] args) {
        RedisClient client = RedisClient.create();
        StatefulRedisConnection<String, String> connection = client.connect(RedisURI.create("localhost", 6379));
        RedisCommands<String, String> commands = connection.sync();
        commands.del("test");
        commands.geoadd("test", 127.055249, 37.5075175, "a");
        commands.geoadd("test", 127.054251, 37.5053014, "b");
        commands.geoadd("test", 127.0643587, 37.5091197, "c");

        commands.georadius("test", 127.0555244, 37.5076318, 10.0, GeoArgs.Unit.km, GeoArgs.Builder.coordinates())
            .forEach(System.out::println);
    }
}

Prints:

GeoWithin [member=b, distance=null, geohash=null, coordinates=(127.05425351858139, 37.50530199861617)]
GeoWithin [member=a, distance=null, geohash=null, coordinates=(127.05425351858139, 37.50751734490944)]
GeoWithin [member=c, distance=null, geohash=null, coordinates=(127.05425351858139, 37.509119288682136)]

Note that all items have same x coordinate.

Expected behavior/code

Each item should have correct x coordinate.

Environment

  • Lettuce version(s): 5.0.4.RELEASE
  • Redis version: 4.0.9

Possible Solution

GeoWithinListOutput#complete(int) should reset previous x after emitting the result item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions