Class JavaUserDefinedUntypedAggregation.MyAverage
- java.lang.Object
-
- org.apache.spark.sql.expressions.UserDefinedAggregateFunction
-
- org.apache.nemo.examples.spark.sql.JavaUserDefinedUntypedAggregation.MyAverage
-
- All Implemented Interfaces:
java.io.Serializable
,scala.Serializable
- Enclosing class:
- JavaUserDefinedUntypedAggregation
public static final class JavaUserDefinedUntypedAggregation.MyAverage extends org.apache.spark.sql.expressions.UserDefinedAggregateFunction
MyAverage class.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MyAverage()
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.spark.sql.types.StructType
bufferSchema()
Data types of values in the aggregation buffer.org.apache.spark.sql.types.DataType
dataType()
The data type of the returned value.boolean
deterministic()
Whether this function always returns the same output on the identical input.java.lang.Double
evaluate(org.apache.spark.sql.Row buffer)
Calculates the final result.void
initialize(org.apache.spark.sql.expressions.MutableAggregationBuffer buffer)
Initializes the given aggregation buffer.org.apache.spark.sql.types.StructType
inputSchema()
Data types of input arguments of this aggregate function.void
merge(org.apache.spark.sql.expressions.MutableAggregationBuffer buffer1, org.apache.spark.sql.Row buffer2)
Merges two aggregation buffers and stores the updated buffer values back to `buffer1`.void
update(org.apache.spark.sql.expressions.MutableAggregationBuffer buffer, org.apache.spark.sql.Row input)
Updates the given aggregation buffer `buffer` with new input data from `input`.
-
-
-
Method Detail
-
inputSchema
public org.apache.spark.sql.types.StructType inputSchema()
Data types of input arguments of this aggregate function.- Specified by:
inputSchema
in classorg.apache.spark.sql.expressions.UserDefinedAggregateFunction
- Returns:
- input schema.
-
bufferSchema
public org.apache.spark.sql.types.StructType bufferSchema()
Data types of values in the aggregation buffer.- Specified by:
bufferSchema
in classorg.apache.spark.sql.expressions.UserDefinedAggregateFunction
- Returns:
- buffer schema.
-
dataType
public org.apache.spark.sql.types.DataType dataType()
The data type of the returned value.- Specified by:
dataType
in classorg.apache.spark.sql.expressions.UserDefinedAggregateFunction
- Returns:
- double type.
-
deterministic
public boolean deterministic()
Whether this function always returns the same output on the identical input.- Specified by:
deterministic
in classorg.apache.spark.sql.expressions.UserDefinedAggregateFunction
- Returns:
- true.
-
initialize
public void initialize(org.apache.spark.sql.expressions.MutableAggregationBuffer buffer)
Initializes the given aggregation buffer. The buffer itself is a `Row` that in addition to standard methods like retrieving a value at an index (e.g., get(), getBoolean()), provides the opportunity to update its values. Note that arrays and maps inside the buffer are still immutable.- Specified by:
initialize
in classorg.apache.spark.sql.expressions.UserDefinedAggregateFunction
- Parameters:
buffer
- buffer to initialize.
-
update
public void update(org.apache.spark.sql.expressions.MutableAggregationBuffer buffer, org.apache.spark.sql.Row input)
Updates the given aggregation buffer `buffer` with new input data from `input`.- Specified by:
update
in classorg.apache.spark.sql.expressions.UserDefinedAggregateFunction
- Parameters:
buffer
- buffer to update.input
- input to update with.
-
merge
public void merge(org.apache.spark.sql.expressions.MutableAggregationBuffer buffer1, org.apache.spark.sql.Row buffer2)
Merges two aggregation buffers and stores the updated buffer values back to `buffer1`.- Specified by:
merge
in classorg.apache.spark.sql.expressions.UserDefinedAggregateFunction
- Parameters:
buffer1
- first buffer.buffer2
- second buffer.
-
evaluate
public java.lang.Double evaluate(org.apache.spark.sql.Row buffer)
Calculates the final result.- Specified by:
evaluate
in classorg.apache.spark.sql.expressions.UserDefinedAggregateFunction
- Parameters:
buffer
- buffer row.- Returns:
- the result.
-
-