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

groupBy hangs (0.7.5) #40

Closed
wizzardo opened this issue Feb 22, 2016 · 7 comments
Closed

groupBy hangs (0.7.5) #40

wizzardo opened this issue Feb 22, 2016 · 7 comments

Comments

@wizzardo
Copy link

Hello, after last update groupBy is not working anymore,
here is the test for it

    @Test(timeout = 1000)
    public void testGroupBy() {
        RTree<Integer, Geometry> tree = RTree.star().create();

        tree = tree.add(1, Geometries.point(13.0, 52.0));
        tree = tree.add(2, Geometries.point(13.0, 52.0));
        tree = tree.add(3, Geometries.point(13.0, 52.0));
        tree = tree.add(4, Geometries.point(13.0, 52.0));
        tree = tree.add(5, Geometries.point(13.0, 52.0));
        tree = tree.add(6, Geometries.point(13.0, 52.0));

        Rectangle rectangle = Geometries.rectangle(12.9, 51.9, 13.1, 52.1);
        assertEquals(Integer.valueOf(6), tree.search(rectangle).count().toBlocking().single());
        assertEquals(Integer.valueOf(2), tree.search(rectangle)
                .groupBy(new Func1<Entry<Integer, Geometry>, Boolean>() {
                    @Override
                    public Boolean call(Entry<Integer, Geometry> entry) {
                        return entry.value() % 2 == 0;
                    }
                })
                .flatMap(new Func1<GroupedObservable<Boolean, Entry<Integer, Geometry>>, Observable<Integer>>() {
                    @Override
                    public Observable<Integer> call(GroupedObservable<Boolean, Entry<Integer, Geometry>> group) {
                        return group.count();
                    }
                })
                .count()
                .toBlocking()
                .single());
    }
@davidmoten
Copy link
Owner

Thanks for the report, I'll look at it very soon

On Tue, 23 Feb 2016 03:28 Mikhail Bobrutskov [email protected]
wrote:

Hello, after last update groupBy is not working anymore,
here is the test for it

@Test(timeout = 1000)
public void testGroupBy() {
    RTree<Integer, Geometry> tree = RTree.star().create();

    tree = tree.add(1, Geometries.point(13.0, 52.0));
    tree = tree.add(2, Geometries.point(13.0, 52.0));
    tree = tree.add(3, Geometries.point(13.0, 52.0));
    tree = tree.add(4, Geometries.point(13.0, 52.0));
    tree = tree.add(5, Geometries.point(13.0, 52.0));
    tree = tree.add(6, Geometries.point(13.0, 52.0));

    Rectangle rectangle = Geometries.rectangle(12.9, 51.9, 13.1, 52.1);
    assertEquals(Integer.valueOf(6), tree.search(rectangle).count().toBlocking().single());
    assertEquals(Integer.valueOf(2), tree.search(rectangle)
            .groupBy(new Func1<Entry<Integer, Geometry>, Boolean>() {
                @Override
                public Boolean call(Entry<Integer, Geometry> entry) {
                    return entry.value() % 2 == 0;
                }
            })
            .flatMap(new Func1<GroupedObservable<Boolean, Entry<Integer, Geometry>>, Observable<Integer>>() {
                @Override
                public Observable<Integer> call(GroupedObservable<Boolean, Entry<Integer, Geometry>> group) {
                    return group.count();
                }
            })
            .count()
            .toBlocking()
            .single());
}


Reply to this email directly or view it on GitHub
#40.

@davidmoten
Copy link
Owner

Looks to have been introduced in rxjava 1.1.1. Downgrade to rxjava 1.1.0 and the test passes. Thanks very much for this it explains a problem at work today! I'll have a look at the problem in rxjava now.

@davidmoten
Copy link
Owner

On close inspection I think it is a bug in rtree that is highlighted by a misbehaving rxjava operator (still correct but shouldn't be requesting Long.MAX_VALUE-1 from upstream). I'll keep investigating.

@davidmoten
Copy link
Owner

misbehaving operator in RxJava was scan that was modifying a request for MAX_VALUE when requesting upstream. I've submitted a PR ReactiveX/RxJava#3727 to RxJava. In the meantime I'll get a fix out for the problem in rtree that this rxjava bug highlighted.

@davidmoten
Copy link
Owner

fix for this issue has been released to Maven Central as rtree 0.7.6

@wizzardo
Copy link
Author

thank you very much for this fast fix

@davidmoten
Copy link
Owner

No problem, I really appreciate the submission of a unit test with the report!

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

No branches or pull requests

2 participants