Class UserDefinedAggregateFunction

Object
org.apache.spark.sql.expressions.UserDefinedAggregateFunction
All Implemented Interfaces:
Serializable, scala.Serializable

public abstract class UserDefinedAggregateFunction extends Object implements scala.Serializable
Deprecated.
UserDefinedAggregateFunction is deprecated. Aggregator[IN, BUF, OUT] should now be registered as a UDF via the functions.udaf(agg) method.
The base class for implementing user-defined aggregate functions (UDAF).

Since:
1.5.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(Column... exprs)
    Deprecated.
    Creates a Column for this UDAF using given Columns as input arguments.
    apply(scala.collection.Seq<Column> exprs)
    Deprecated.
    Creates a Column for this UDAF using given Columns as input arguments.
    abstract StructType
    Deprecated.
    A StructType represents data types of values in the aggregation buffer.
    abstract DataType
    Deprecated.
    The DataType of the returned value of this UserDefinedAggregateFunction.
    abstract boolean
    Deprecated.
    Returns true iff this function is deterministic, i.e. given the same input, always return the same output.
    distinct(Column... exprs)
    Deprecated.
    Creates a Column for this UDAF using the distinct values of the given Columns as input arguments.
    distinct(scala.collection.Seq<Column> exprs)
    Deprecated.
    Creates a Column for this UDAF using the distinct values of the given Columns as input arguments.
    abstract Object
    evaluate(Row buffer)
    Deprecated.
    Calculates the final result of this UserDefinedAggregateFunction based on the given aggregation buffer.
    abstract void
    Deprecated.
    Initializes the given aggregation buffer, i.e. the zero value of the aggregation buffer.
    abstract StructType
    Deprecated.
    A StructType represents data types of input arguments of this aggregate function.
    abstract void
    merge(MutableAggregationBuffer buffer1, Row buffer2)
    Deprecated.
    Merges two aggregation buffers and stores the updated buffer values back to buffer1.
    abstract void
    Deprecated.
    Updates the given aggregation buffer buffer with new input data from input.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UserDefinedAggregateFunction

      public UserDefinedAggregateFunction()
      Deprecated.
  • Method Details

    • apply

      public Column apply(Column... exprs)
      Deprecated.
      Creates a Column for this UDAF using given Columns as input arguments.

      Parameters:
      exprs - (undocumented)
      Returns:
      (undocumented)
      Since:
      1.5.0
    • apply

      public Column apply(scala.collection.Seq<Column> exprs)
      Deprecated.
      Creates a Column for this UDAF using given Columns as input arguments.

      Parameters:
      exprs - (undocumented)
      Returns:
      (undocumented)
      Since:
      1.5.0
    • bufferSchema

      public abstract StructType bufferSchema()
      Deprecated.
      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 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.

      Returns:
      (undocumented)
      Since:
      1.5.0
    • dataType

      public abstract DataType dataType()
      Deprecated.
      The DataType of the returned value of this UserDefinedAggregateFunction.

      Returns:
      (undocumented)
      Since:
      1.5.0
    • deterministic

      public abstract boolean deterministic()
      Deprecated.
      Returns true iff this function is deterministic, i.e. given the same input, always return the same output.

      Returns:
      (undocumented)
      Since:
      1.5.0
    • distinct

      public Column distinct(Column... exprs)
      Deprecated.
      Creates a Column for this UDAF using the distinct values of the given Columns as input arguments.

      Parameters:
      exprs - (undocumented)
      Returns:
      (undocumented)
      Since:
      1.5.0
    • distinct

      public Column distinct(scala.collection.Seq<Column> exprs)
      Deprecated.
      Creates a Column for this UDAF using the distinct values of the given Columns as input arguments.

      Parameters:
      exprs - (undocumented)
      Returns:
      (undocumented)
      Since:
      1.5.0
    • evaluate

      public abstract Object evaluate(Row buffer)
      Deprecated.
      Calculates the final result of this UserDefinedAggregateFunction based on the given aggregation buffer.

      Parameters:
      buffer - (undocumented)
      Returns:
      (undocumented)
      Since:
      1.5.0
    • initialize

      public abstract void initialize(MutableAggregationBuffer buffer)
      Deprecated.
      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 equal initialBuffer.

      Parameters:
      buffer - (undocumented)
      Since:
      1.5.0
    • inputSchema

      public abstract StructType inputSchema()
      Deprecated.
      A 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.

      Returns:
      (undocumented)
      Since:
      1.5.0
    • merge

      public abstract void merge(MutableAggregationBuffer buffer1, Row buffer2)
      Deprecated.
      Merges two aggregation buffers and stores the updated buffer values back to buffer1.

      This is called when we merge two partially aggregated data together.

      Parameters:
      buffer1 - (undocumented)
      buffer2 - (undocumented)
      Since:
      1.5.0
    • update

      public abstract void update(MutableAggregationBuffer buffer, Row input)
      Deprecated.
      Updates the given aggregation buffer buffer with new input data from input.

      This is called once per input row.

      Parameters:
      buffer - (undocumented)
      input - (undocumented)
      Since:
      1.5.0