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).HiveException
public abstract GenericUDAFEvaluator.AggregationBuffer getNewAggregationBuffer() throws HiveException
HiveException
public abstract void reset(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
HiveException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public 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().HiveException
public Object evaluate(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
agg
- The object to store the aggregation result.HiveException
public abstract void iterate(GenericUDAFEvaluator.AggregationBuffer agg, Object[] parameters) throws HiveException
parameters
- The objects of parameters.HiveException
public abstract Object terminatePartial(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
HiveException
public abstract void merge(GenericUDAFEvaluator.AggregationBuffer agg, Object partial) throws HiveException
partial
- The partial aggregation result.HiveException
public abstract Object terminate(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
HiveException
public 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.