|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.crunch.DoFn<T,T> org.apache.crunch.FilterFn<T>
public abstract class FilterFn<T>
A DoFn
for the common case of filtering the members of a
PCollection
based on a boolean condition.
Nested Class Summary | |
---|---|
static class |
FilterFn.AndFn<S>
Deprecated. Use FilterFns.and(FilterFn...) |
static class |
FilterFn.NotFn<S>
Deprecated. Use FilterFns.not(FilterFn) |
static class |
FilterFn.OrFn<S>
Deprecated. Use FilterFns.or(FilterFn...) |
Constructor Summary | |
---|---|
FilterFn()
|
Method Summary | ||
---|---|---|
abstract boolean |
accept(T input)
If true, emit the given record. |
|
static
|
and(FilterFn<S>... fns)
Deprecated. Use FilterFns.and(FilterFn...) |
|
void |
cleanup()
Called during the cleanup of the MapReduce job this FilterFn is
associated with. |
|
void |
cleanup(Emitter<T> emitter)
Called during the cleanup of the MapReduce job this DoFn is
associated with. |
|
static
|
not(FilterFn<S> fn)
Deprecated. Use FilterFns.not(FilterFn) |
|
static
|
or(FilterFn<S>... fns)
Deprecated. Use FilterFns.or(FilterFn...) |
|
void |
process(T input,
Emitter<T> emitter)
Processes the records from a PCollection . |
|
float |
scaleFactor()
Returns an estimate of how applying this function to a PCollection
will cause it to change in side. |
Methods inherited from class org.apache.crunch.DoFn |
---|
configure, initialize, setContext |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilterFn()
Method Detail |
---|
public abstract boolean accept(T input)
public void process(T input, Emitter<T> emitter)
DoFn
PCollection
.
DoFn.process(Object, Emitter)
method call. This
functionality is imposed by Hadoop's Reducer implementation: The framework will reuse the key and value
objects that are passed into the reduce, therefore the application should
clone the objects they want to keep a copy of.
process
in class DoFn<T,T>
input
- The input record.emitter
- The emitter to send the output topublic final void cleanup(Emitter<T> emitter)
DoFn
DoFn
is
associated with. Subclasses may override this method to do appropriate
cleanup.
cleanup
in class DoFn<T,T>
emitter
- The emitter that was used for outputpublic void cleanup()
FilterFn
is
associated with. Subclasses may override this method to do appropriate
cleanup.
public float scaleFactor()
DoFn
PCollection
will cause it to change in side. The optimizer uses these estimates to
decide where to break up dependent MR jobs into separate Map and Reduce
phases in order to minimize I/O.
Subclasses of DoFn
that will substantially alter the size of the
resulting PCollection
should override this method.
scaleFactor
in class DoFn<T,T>
public static <S> FilterFn<S> and(FilterFn<S>... fns)
FilterFns.and(FilterFn...)
public static <S> FilterFn<S> or(FilterFn<S>... fns)
FilterFns.or(FilterFn...)
public static <S> FilterFn<S> not(FilterFn<S> fn)
FilterFns.not(FilterFn)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |