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| Modifier and Type | Method and Description |
|---|---|
PCollection<T> |
apply(PCollection<T> input)
Applies this
PTransform on the given InputT, and returns its
Output. |
static <T,PredicateT extends SerializableFunction<T,Boolean>> |
by(PredicateT filterPred)
Deprecated.
use
byPredicate, which returns a Filter transform instead of
a ParDo.Bound. |
static <T,PredicateT extends SerializableFunction<T,Boolean>> |
byPredicate(PredicateT predicate)
Returns a
PTransform that takes an input
PCollection<T> and returns a PCollection<T> with
elements that satisfy the given predicate. |
protected Coder<T> |
getDefaultOutputCoder(PCollection<T> input)
Returns the default
Coder to use for the output of this
single-output PTransform when applied to the given input. |
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 and returns a PCollection 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. |
Filter<T> |
named(String name) |
getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, toString, validatepublic static <T,PredicateT extends SerializableFunction<T,Boolean>> Filter<T> byPredicate(PredicateT predicate)
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.byPredicate(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.
@Deprecated public static <T,PredicateT extends SerializableFunction<T,Boolean>> ParDo.Bound<T,T> by(PredicateT filterPred)
byPredicate, which returns a Filter transform instead of
a ParDo.Bound.public static <T extends Comparable<T>> ParDo.Bound<T,T> lessThan(T value)
PTransform that takes an input
PCollection and returns a PCollection 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 byPredicate(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 byPredicate(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 byPredicate(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 byPredicate(PredicateT), which returns elements
that satisfy the given predicate.
public PCollection<T> apply(PCollection<T> input)
PTransformPTransform on the given InputT, and returns its
Output.
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
The default implementation throws an exception. A derived class must
either implement apply, or else each runner must supply a custom
implementation via
PipelineRunner.apply(com.google.cloud.dataflow.sdk.transforms.PTransform<InputT, OutputT>, InputT).
apply in class PTransform<PCollection<T>,PCollection<T>>protected Coder<T> getDefaultOutputCoder(PCollection<T> input)
PTransformCoder to use for the output of this
single-output PTransform when applied to the given input.getDefaultOutputCoder in class PTransform<PCollection<T>,PCollection<T>>