T - the type of the values in the input PCollection,
and the type of the elements in the output PCollectionpublic class Filter<T> extends PTransform<PCollection<T>,PCollection<T>>
PTransforms for filtering from a PCollection the
elements satisfying a predicate, or satisfying an inequality with
a given value based on the elements' natural ordering.name| Constructor and Description |
|---|
Filter() |
| Modifier and Type | Method and Description |
|---|---|
static <T,PredicateT extends SerializableFunction<T,Boolean>> |
by(PredicateT filterPred)
Returns a
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that satisfy the given predicate. |
static <T extends Comparable<T>> |
greaterThan(T value)
Returns a
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that are greater than a given value, based on the
elements' natural ordering. |
static <T extends Comparable<T>> |
greaterThanEq(T value)
Returns a
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that are greater than or equal to a given value, based on
the elements' natural ordering. |
static <T extends Comparable<T>> |
lessThan(T value)
Returns a
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that are less than a given value, based on the
elements' natural ordering. |
static <T extends Comparable<T>> |
lessThanEq(T value)
Returns a
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that are less than or equal to a given value, based on the
elements' natural ordering. |
apply, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, toString, validatepublic static <T,PredicateT extends SerializableFunction<T,Boolean>> ParDo.Bound<T,T> by(PredicateT filterPred)
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that satisfy the given predicate. The predicate must be
a SerializableFunction<T, Boolean>.
Example of use:
PCollection<String> wordList = ...;
PCollection<String> longWords =
wordList.apply(Filter.by(new MatchIfWordLengthGT(6)));
See also lessThan(T), lessThanEq(T),
greaterThan(T), greaterThanEq(T), which return elements
satisfying various inequalities with the specified value based on
the elements' natural ordering.
public static <T extends Comparable<T>> ParDo.Bound<T,T> lessThan(T value)
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that are less than a given value, based on the
elements' natural ordering. Elements must be Comparable.
Example of use:
PCollection<Integer> listOfNumbers = ...;
PCollection<Integer> smallNumbers =
listOfNumbers.apply(Filter.lessThan(10));
See also lessThanEq(T), greaterThanEq(T),
and greaterThan(T), which return elements satisfying various
inequalities with the specified value based on the elements'
natural ordering.
See also by(PredicateT), which returns elements
that satisfy the given predicate.
public static <T extends Comparable<T>> ParDo.Bound<T,T> greaterThan(T value)
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that are greater than a given value, based on the
elements' natural ordering. Elements must be Comparable.
Example of use:
PCollection<Integer> listOfNumbers = ...;
PCollection<Integer> largeNumbers =
listOfNumbers.apply(Filter.greaterThan(1000));
See also greaterThanEq(T), lessThan(T),
and lessThanEq(T), which return elements satisfying various
inequalities with the specified value based on the elements'
natural ordering.
See also by(PredicateT), which returns elements
that satisfy the given predicate.
public static <T extends Comparable<T>> ParDo.Bound<T,T> lessThanEq(T value)
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that are less than or equal to a given value, based on the
elements' natural ordering. Elements must be Comparable.
Example of use:
PCollection<Integer> listOfNumbers = ...;
PCollection<Integer> smallOrEqualNumbers =
listOfNumbers.apply(Filter.lessThanEq(10));
See also lessThan(T), greaterThanEq(T),
and greaterThan(T), which return elements satisfying various
inequalities with the specified value based on the elements'
natural ordering.
See also by(PredicateT), which returns elements
that satisfy the given predicate.
public static <T extends Comparable<T>> ParDo.Bound<T,T> greaterThanEq(T value)
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that are greater than or equal to a given value, based on
the elements' natural ordering. Elements must be Comparable.
Example of use:
PCollection<Integer> listOfNumbers = ...;
PCollection<Integer> largeOrEqualNumbers =
listOfNumbers.apply(Filter.greaterThanEq(1000));
See also greaterThan(T), lessThan(T),
and lessThanEq(T), which return elements satisfying various
inequalities with the specified value based on the elements'
natural ordering.
See also by(PredicateT), which returns elements
that satisfy the given predicate.