Splitting and merging streams
When indexing you might want to apply different transformations based on a condition.
Instead of building multiple streams or applying transformations conditionally, streams can also be split.
.split_by
takes a predicate. If the predicate is true, nodes will go left, otherwise they will go right.
For example:
Split streams are not lazy and implemented with buffered channels under the hood. This means that there should not be any slow code inbetween splitting and running the resulting pipelines. The merging is optional, you can also run each stream independently. However, because they’re not lazy, they would need to be run in parallel.