-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature description
In v4 .batch() is a simple transform which groups chunks by a given number:
// input: [1,2,3,4,5,6,7,8,9,10]
// batch(amount)
.batch(2) -> [1,2], [3,4], [5,6], ...and in pre-v5 it accepts a callback but we plan to introduce batching by amount the same as v4 too.
Now, it could be extended by adding optional step param which will allow to change how chunks are grouped:
// input: [1,2,3,4,5,6,7,8,9,10]
// batch(amount, step = amount)
.batch(2) -> [1,2], [3,4], [5,6], ...
.batch(2, 2) -> [1,2], [3,4], [5,6], ...
.batch(2, 1) -> [1,2], [2,3], [3,4], ...
.batch(3, 2) -> [1, 2, 3], [3, 4, 5], [5, 6, 7], ...Use case
The use case is - creating a WindowStream out of any other stream with ability to decide how each window frame content is grouped. And in the context of the above proposal it could be:
anyStream.batch(3, 2).as(WindowStream)Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request