Filter
Given a predicate, filter out all elements that don’t satisfy that predicate. May also be used to filter based on an inequality with a given value based on the natural ordering of the element.
Examples
Example 1: Filtering with a predicate
The result is a
PCollection
containing “Hello” and “world”.Example 2: Filtering with an inequality
Other variants include
Filter.greaterThanEq
, Filter.lessThan
and Filter.equal
.Example 3: Filtering with lambda
Related transforms
- FlatMapElements behaves the same as
Map
, but for each input it might produce zero or more outputs. - ParDo is the most general element-wise mapping operation, and includes other abilities such as multiple output collections and side-inputs.
Last updated on 2024/11/14
Have you found everything you were looking for?
Was it all useful and clear? Is there anything that you would like to change? Let us know!