public abstract class GenericUDAFEvaluator extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericUDAFEvaluator.AbstractAggregationBuffer |
static interface |
GenericUDAFEvaluator.AggregationBuffer
Deprecated.
use
GenericUDAFEvaluator.AbstractAggregationBuffer instead |
static interface |
GenericUDAFEvaluator.AggregationType |
static class |
GenericUDAFEvaluator.Mode
Mode.
|
| Constructor and Description |
|---|
GenericUDAFEvaluator()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
aggregate(GenericUDAFEvaluator.AggregationBuffer agg,
Object[] parameters)
This function will be called by GroupByOperator when it sees a new input
row.
|
void |
close()
Close GenericUDFEvaluator.
|
void |
configure(MapredContext mapredContext)
Additionally setup GenericUDAFEvaluator with MapredContext before initializing.
|
Object |
evaluate(GenericUDAFEvaluator.AggregationBuffer agg)
This function will be called by GroupByOperator when it sees a new input
row.
|
abstract GenericUDAFEvaluator.AggregationBuffer |
getNewAggregationBuffer()
Get a new aggregation object.
|
GenericUDAFEvaluator |
getWindowingEvaluator(WindowFrameDef wFrmDef)
When evaluating an aggregates over a fixed Window, the naive way to compute
results is to compute the aggregate for each row.
|
ObjectInspector |
init(GenericUDAFEvaluator.Mode m,
ObjectInspector[] parameters)
Initialize the evaluator.
|
static boolean |
isEstimable(GenericUDAFEvaluator.AggregationBuffer buffer) |
abstract void |
iterate(GenericUDAFEvaluator.AggregationBuffer agg,
Object[] parameters)
Iterate through original data.
|
abstract void |
merge(GenericUDAFEvaluator.AggregationBuffer agg,
Object partial)
Merge with partial aggregation result.
|
abstract void |
reset(GenericUDAFEvaluator.AggregationBuffer agg)
Reset the aggregation.
|
abstract Object |
terminate(GenericUDAFEvaluator.AggregationBuffer agg)
Get final aggregation result.
|
abstract Object |
terminatePartial(GenericUDAFEvaluator.AggregationBuffer agg)
Get partial aggregation result.
|
public static boolean isEstimable(GenericUDAFEvaluator.AggregationBuffer buffer)
public void configure(MapredContext mapredContext)
mapredContext - contextpublic ObjectInspector init(GenericUDAFEvaluator.Mode m, ObjectInspector[] parameters) throws HiveException
m - The mode of aggregation.parameters - The ObjectInspector for the parameters: In PARTIAL1 and COMPLETE
mode, the parameters are original data; In PARTIAL2 and FINAL
mode, the parameters are just partial aggregations (in that case,
the array will always have a single element).HiveExceptionpublic abstract GenericUDAFEvaluator.AggregationBuffer getNewAggregationBuffer() throws HiveException
HiveExceptionpublic abstract void reset(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
HiveExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void aggregate(GenericUDAFEvaluator.AggregationBuffer agg, Object[] parameters) throws HiveException
agg - The object to store the aggregation result.parameters - The row, can be inspected by the OIs passed in init().HiveExceptionpublic Object evaluate(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
agg - The object to store the aggregation result.HiveExceptionpublic abstract void iterate(GenericUDAFEvaluator.AggregationBuffer agg, Object[] parameters) throws HiveException
parameters - The objects of parameters.HiveExceptionpublic abstract Object terminatePartial(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
HiveExceptionpublic abstract void merge(GenericUDAFEvaluator.AggregationBuffer agg, Object partial) throws HiveException
partial - The partial aggregation result.HiveExceptionpublic abstract Object terminate(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
HiveExceptionpublic GenericUDAFEvaluator getWindowingEvaluator(WindowFrameDef wFrmDef)
This method is called after this Evaluator is initialized. The returned Function must be initialized. It is passed the 'window' of aggregation for each row.
wFrmDef - the Window definition in play for this evaluation.Copyright © 2017 The Apache Software Foundation. All rights reserved.