|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ebay.erl.mobius.core.function.base.Projectable
com.ebay.erl.mobius.core.function.base.GroupFunction
com.ebay.erl.mobius.core.function.base.AggregateFunction
com.ebay.erl.mobius.core.function.base.SingleInputAggregateFunction
com.ebay.erl.mobius.core.function.Medium
public class Medium
Gets the medium value of the inputColumn
in
a group. The ordering is natural ordering by default, user
can override the ordering by providing a comparator.
This product is licensed under the Apache License, Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0. This product contains portions derived from Apache hadoop which is licensed under the Apache License, Version 2.0, available at http://hadoop.apache.org. © 2007 – 2012 eBay Inc., Evan Chiu, Woody Zhou, Neel Sundaresan
Field Summary |
---|
Fields inherited from class com.ebay.erl.mobius.core.function.base.SingleInputAggregateFunction |
---|
inputColumnName |
Fields inherited from class com.ebay.erl.mobius.core.function.base.AggregateFunction |
---|
aggregateResult |
Fields inherited from class com.ebay.erl.mobius.core.function.base.GroupFunction |
---|
rowsToBeOutputted |
Fields inherited from class com.ebay.erl.mobius.core.function.base.Projectable |
---|
conf, hashCode, inputs, outputSchema, reporter, requireDataFromMultiDatasets |
Constructor Summary | |
---|---|
Medium(Column inputColumn)
Create an instance of Medium operation to
get the medium value of the given
inputColumn within a group. |
|
Medium(Column inputColumn,
java.lang.Class<? extends java.util.Comparator<Tuple>> comparator)
Create an instance of Medium operation to
get the medium value of the given
inputColumn within a group. |
Method Summary | |
---|---|
void |
consume(Tuple tuple)
consume a value within a group, to be implemented by sub-class. |
Tuple |
getComputedResult()
Return the computed result in a Tuple . |
protected BigTupleList |
newBigTupleList()
override from parent to have the returned BigTupleList
use user defined comparator, if any. |
void |
reset()
Empty previous result ( rowsToBeOutputted ), reset is
called when the values within a group have been all iterated. |
Methods inherited from class com.ebay.erl.mobius.core.function.base.AggregateFunction |
---|
getResult, output |
Methods inherited from class com.ebay.erl.mobius.core.function.base.GroupFunction |
---|
getNoMatchResult, getRowsToBeOutputted |
Methods inherited from class com.ebay.erl.mobius.core.function.base.Projectable |
---|
calledByCombiner, equals, getConf, getInputColumns, getOutputSchema, getParticipatedDataset, hashCode, init, isCombinable, requireDataFromMultiDatasets, setCalledByCombiner, setConf, setOutputSchema, setReporter, toString, useGroupKeyOnly |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Medium(Column inputColumn)
Medium
operation to
get the medium value of the given
inputColumn
within a group.
The comparing is natural ordering.
public Medium(Column inputColumn, java.lang.Class<? extends java.util.Comparator<Tuple>> comparator)
Medium
operation to
get the medium value of the given
inputColumn
within a group.
The comparing is done by user specified comparator
.
Method Detail |
---|
protected BigTupleList newBigTupleList()
BigTupleList
use user defined comparator, if any.
newBigTupleList
in class AggregateFunction
public void consume(Tuple tuple)
GroupFunction
consume
in class GroupFunction
public Tuple getComputedResult()
SingleInputAggregateFunction
Tuple
.
By default, the returned Tuple
contains only
one column, the name of the column is the first
element in the Projectable.getOutputSchema()
.
Override this method if there is a need to output a
Tuple
with more than one column.
getComputedResult
in class SingleInputAggregateFunction
public void reset()
GroupFunction
rowsToBeOutputted
), reset is
called when the values within a group have been all iterated.
It is important to call super.reset() when override this method in a sub-class, fail to do so, will result in wrong result.
reset
in class AggregateFunction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |