Open turja12 opened 7 years ago
The streamOf(ResultSet) method returns a sequential stream, and actually it's not recommended to convert this into a parallel()
stream.
Concurrent readers and writers are supported, but each concurrent reader should read from a different ResultSet object. This is because ResultSets are stateful. They encapsulate the reader's position when traversing indexes, and they can store state for some operations which are not easily parallelized such as ordering or deduplicating results.
So if you want to process results in parallel, you could:
So sorry about the confusion! I agree that calling .parallel()
on the stream is a totally reasonably thing to do given that Java 8 provides an API for it! So I'll try to put a fix in the code to prevent this if possible, or else I'll document this better. I'll keep this issue open as a reminder until then.
Best regards, Niall
Thanks for explanation.
Hello, we are getting incorrect results for groupingByConcurent. There is some ghost result which match just part of query. I hope this will be enough for fixing, we are doing grouping on large dataset and doing it in parallel is much faster.
I create simple example of code which is failing.
output of this program is here :