abstract class UserDefinedAggregateFunction extends Serializable
The base class for implementing user-defined aggregate functions (UDAF).
- Annotations
- @Stable()
- Since
1.5.0
- Alphabetic
- By Inheritance
- UserDefinedAggregateFunction
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new UserDefinedAggregateFunction()
Abstract Value Members
-
abstract
def
bufferSchema: StructType
A
StructType
represents data types of values in the aggregation buffer.A
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 ofDoubleType
andLongType
, the returnedStructType
will look likenew 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.- Since
1.5.0
-
abstract
def
dataType: DataType
The
DataType
of the returned value of this UserDefinedAggregateFunction.The
DataType
of the returned value of this UserDefinedAggregateFunction.- Since
1.5.0
-
abstract
def
deterministic: Boolean
Returns true iff this function is deterministic, i.e.
Returns true iff this function is deterministic, i.e. given the same input, always return the same output.
- Since
1.5.0
-
abstract
def
evaluate(buffer: Row): Any
Calculates the final result of this UserDefinedAggregateFunction based on the given aggregation buffer.
Calculates the final result of this UserDefinedAggregateFunction based on the given aggregation buffer.
- Since
1.5.0
-
abstract
def
initialize(buffer: MutableAggregationBuffer): Unit
Initializes the given aggregation buffer, i.e.
Initializes the given aggregation buffer, i.e. the zero value of the aggregation 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 equalinitialBuffer
.- Since
1.5.0
-
abstract
def
inputSchema: StructType
A
StructType
represents data types of input arguments of this aggregate function.A
StructType
represents data types of input arguments of this aggregate function. For example, if a UserDefinedAggregateFunction expects two input arguments with type ofDoubleType
andLongType
, the returnedStructType
will look likenew 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.- Since
1.5.0
-
abstract
def
merge(buffer1: MutableAggregationBuffer, buffer2: Row): Unit
Merges two aggregation buffers and stores the updated buffer values back to
buffer1
.Merges two aggregation buffers and stores the updated buffer values back to
buffer1
.This is called when we merge two partially aggregated data together.
- Since
1.5.0
-
abstract
def
update(buffer: MutableAggregationBuffer, input: Row): Unit
Updates the given aggregation buffer
buffer
with new input data frominput
.Updates the given aggregation buffer
buffer
with new input data frominput
.This is called once per input row.
- Since
1.5.0
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
apply(exprs: Column*): Column
Creates a
Column
for this UDAF using givenColumn
s as input arguments.Creates a
Column
for this UDAF using givenColumn
s as input arguments.- Annotations
- @varargs()
- Since
1.5.0
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
distinct(exprs: Column*): Column
Creates a
Column
for this UDAF using the distinct values of the givenColumn
s as input arguments.Creates a
Column
for this UDAF using the distinct values of the givenColumn
s as input arguments.- Annotations
- @varargs()
- Since
1.5.0
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )