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.annotations, displayData, name, resourceHints| Modifier and Type | Method and Description |
|---|---|
static <T,PredicateT extends ProcessFunction<T,java.lang.Boolean>> |
by(PredicateT predicate)
Returns a
PTransform that takes an input PCollection<T> and returns a PCollection<T> with elements that satisfy the given predicate. |
static <T,PredicateT extends SerializableFunction<T,java.lang.Boolean>> |
by(PredicateT predicate)
Binary compatibility adapter for
by(ProcessFunction). |
static <T extends java.lang.Comparable<T>> |
equal(T value)
Returns a
PTransform that takes an input PCollection<T> and returns a PCollection<T> with elements that equals to a given value. |
PCollection<T> |
expand(PCollection<T> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT. |
static <T extends java.lang.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 java.lang.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 java.lang.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 java.lang.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. |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setDisplayData, setResourceHints, toString, validate, validatepublic static <T,PredicateT extends ProcessFunction<T,java.lang.Boolean>> Filter<T> by(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 ProcessFunction<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,PredicateT extends SerializableFunction<T,java.lang.Boolean>> Filter<T> by(PredicateT predicate)
by(ProcessFunction).public static <T extends java.lang.Comparable<T>> Filter<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), equal(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 java.lang.Comparable<T>> Filter<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), equal(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 java.lang.Comparable<T>> Filter<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), equal(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 java.lang.Comparable<T>> Filter<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), equal(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 java.lang.Comparable<T>> Filter<T> equal(T value)
PTransform that takes an input PCollection<T> and returns a PCollection<T> with elements that equals to a given value. Elements must be Comparable.
Example of use:
PCollection<Integer> listOfNumbers = ...;
PCollection<Integer> equalNumbers = listOfNumbers.apply(Filter.equal(1000));
See also greaterThan(T), lessThan(T), lessThanEq(T) and greaterThanEq(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 PCollection<T> expand(PCollection<T> input)
PTransformPTransform should be expanded on the given
InputT.
NOTE: This method should not be called directly. Instead apply the PTransform should
be applied to the InputT using the apply method.
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).
expand in class PTransform<PCollection<T>,PCollection<T>>public void populateDisplayData(DisplayData.Builder builder)
PTransformpopulateDisplayData(DisplayData.Builder) is invoked by Pipeline runners to collect
display data via DisplayData.from(HasDisplayData). Implementations may call super.populateDisplayData(builder) in order to register display data in the current namespace,
but should otherwise use subcomponent.populateDisplayData(builder) to use the namespace
of the subcomponent.
By default, does not register any display data. Implementors may override this method to provide their own display data.
populateDisplayData in interface HasDisplayDatapopulateDisplayData in class PTransform<PCollection<T>,PCollection<T>>builder - The builder to populate with display data.HasDisplayData