-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Re-implement GroupBy Operator #570
Comments
And please, when you do so, also make it work with multiple subscribers. @manojo and me ran into this issue yesterday, and I wanted to open another issue when I just saw this ;-) |
I've read through both issues but still don't quite understand the problem. @benjchristensen and/or @samuelgruetter , could you please reiterate the requirements and corner cases? Edit: Somewhat related issue in Rx.NET. |
This should be added to the documentation. There's a problem I remember, but I don't have a proper test illustrating this right now. I used |
What do you think of the explanation/illustration here: https://github.com/Netflix/RxJava/wiki/Transforming-Observables#groupby-and-groupbyuntil Note that when groupBy( ) or groupByUntil( ) splits up the source The following illustration shows how this can cause unexpected behavior: In However, zip( ) does not apply this zip function until it observes an item On Sun, Dec 8, 2013 at 7:08 AM, samuelgruetter [email protected]:
David M. Gross |
You can fix the odd-even issue by using ReplaySubject in groupBy instead of the default PublishSubject. I think this is unnecessarily strong and memory-consuming solution which needs to be paid on every groupBy use case, not just these non-immediate consuming versions. For the cases where the immediate consumption is not possible, one could use a replay() mapped group manually: Observable<Integer> source = Observable.from(1,2,3,4,5,6,7,8,9,10);
Observable.concat(
source.groupBy(x -> x % 2 == 0).map(u -> u.replay()).doOnEach(v -> v.connect()))
.subscribe(System.out::println); |
Are we happy with the current |
From what I can tell |
Nice! I'll try some edge cases ... |
It was fully re-implemented and I know of no problems at this time so closing it. |
The GroupBy operator almost certainly needs to be rewritten. History on the discussions and attempts at fixing it can be seen at #282 and #289
The text was updated successfully, but these errors were encountered: