public abstract class UserDefinedAggregateFunction
extends java.lang.Object
implements scala.Serializable
Constructor and Description |
---|
UserDefinedAggregateFunction() |
Modifier and Type | Method and Description |
---|---|
Column |
apply(Column... exprs)
Creates a
Column for this UDAF using given Column s as input arguments. |
Column |
apply(scala.collection.Seq<Column> exprs)
Creates a
Column for this UDAF using given Column s as input arguments. |
abstract StructType |
bufferSchema()
A
StructType represents data types of values in the aggregation buffer. |
abstract DataType |
dataType()
The
DataType of the returned value of this UserDefinedAggregateFunction . |
abstract boolean |
deterministic()
Returns true iff this function is deterministic, i.e.
|
Column |
distinct(Column... exprs)
Creates a
Column for this UDAF using the distinct values of the given
Column s as input arguments. |
Column |
distinct(scala.collection.Seq<Column> exprs)
Creates a
Column for this UDAF using the distinct values of the given
Column s as input arguments. |
abstract java.lang.Object |
evaluate(Row buffer)
Calculates the final result of this
UserDefinedAggregateFunction based on the given
aggregation buffer. |
abstract void |
initialize(MutableAggregationBuffer buffer)
Initializes the given aggregation buffer, i.e.
|
abstract StructType |
inputSchema()
A
StructType represents data types of input arguments of this aggregate function. |
abstract void |
merge(MutableAggregationBuffer buffer1,
Row buffer2)
Merges two aggregation buffers and stores the updated buffer values back to
buffer1 . |
abstract void |
update(MutableAggregationBuffer buffer,
Row input)
Updates the given aggregation buffer
buffer with new input data from input . |
public Column apply(Column... exprs)
Column
for this UDAF using given Column
s as input arguments.exprs
- (undocumented)public Column distinct(Column... exprs)
Column
for this UDAF using the distinct values of the given
Column
s as input arguments.exprs
- (undocumented)public abstract StructType inputSchema()
StructType
represents data types of input arguments of this aggregate function.
For example, if a UserDefinedAggregateFunction
expects two input arguments
with type of DoubleType
and LongType
, the returned StructType
will look like
new StructType()
.add("doubleInput", DoubleType)
.add("longInput", LongType)
The name of a field of this StructType
is only used to identify the corresponding
input argument. Users can choose names to identify the input arguments.
public abstract StructType bufferSchema()
StructType
represents data types of values in the aggregation buffer.
For example, if a UserDefinedAggregateFunction
's buffer has two values
(i.e. two intermediate values) with type of DoubleType
and LongType
,
the returned StructType
will look like
new StructType()
.add("doubleInput", DoubleType)
.add("longInput", LongType)
The name of a field of this StructType
is only used to identify the corresponding
buffer value. Users can choose names to identify the input arguments.
public abstract DataType dataType()
DataType
of the returned value of this UserDefinedAggregateFunction
.public abstract boolean deterministic()
public abstract void initialize(MutableAggregationBuffer buffer)
The contract should be that applying the merge function on two initial buffers should just
return the initial buffer itself, i.e.
merge(initialBuffer, initialBuffer)
should equal initialBuffer
.
buffer
- (undocumented)public abstract void update(MutableAggregationBuffer buffer, Row input)
buffer
with new input data from input
.
This is called once per input row.
buffer
- (undocumented)input
- (undocumented)public abstract void merge(MutableAggregationBuffer buffer1, Row buffer2)
buffer1
.
This is called when we merge two partially aggregated data together.
buffer1
- (undocumented)buffer2
- (undocumented)public abstract java.lang.Object evaluate(Row buffer)
UserDefinedAggregateFunction
based on the given
aggregation buffer.buffer
- (undocumented)public Column apply(scala.collection.Seq<Column> exprs)
Column
for this UDAF using given Column
s as input arguments.exprs
- (undocumented)