-
Notifications
You must be signed in to change notification settings - Fork 608
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
fix rechunkRandomly with large ending chunk #3277
Changes from 3 commits
e5a5510
7bddd07
b46a9ae
d10da7b
916e836
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1354,6 +1354,16 @@ class StreamCombinatorsSuite extends Fs2Suite { | |||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
test("rechunkRandomlyWithSeed should correclty rechunk big chunks at the end of a stream") { | ||||||
domaspoliakas marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
val chunks = Stream | ||||||
.chunk(Chunk.seq(List.fill(5000)(1))) | ||||||
.rechunkRandomlyWithSeed(0.01, 0.1)(1L) | ||||||
.chunks | ||||||
.compile | ||||||
.toList | ||||||
assert(chunks.forall(_.size < 500)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a small comment, if I understand the documentation and the implementation of the
Suggested change
But I could be wrong about that. 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, it should be inclusive |
||||||
} | ||||||
} | ||||||
|
||||||
group("rechunkRandomly") { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea, since the new implementation is slightly more complex anyway, maybe we could avoid creation of the
random
object (val random = new scala.util.Random(seed)
) in this empty case, since it's then not used? Or perhaps it's not worth it, not sure. 🙂There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but I'm not sure if it's worth it. It'd only have any effect if the random rechunking was called repeatedly on empty streams, which seems like an extraordinarily niche scenario.
Anyway, I'm happy to do it if told otherwise, but I'll save the CI electricity for now