Skip to content

TypedImperativeAggregate Expressions

TypedImperativeAggregate is an extension of the ImperativeAggregate abstraction for typed ImperativeAggregates.

Contract

Creating Aggregation Buffer

createAggregationBuffer(): T

See:

Used when:

Deserializing

deserialize(
  storageFormat: Array[Byte]): T

See:

Used when:

  • TypedImperativeAggregate is requested to merge

Interpreted Execution

eval(
  buffer: T): Any

See:

Used when:

merge

merge(
  buffer: T,
  input: T): T

See:

Used when:

serialize

serialize(
  buffer: T): Array[Byte]

See:

Used when:

update

update(
  buffer: T,
  input: InternalRow): T

See:

Used when:

  • TypedImperativeAggregate is requested to update

Implementations

Interpreted Expression Evaluation

eval(
  buffer: InternalRow): Any

eval is part of the Expression abstraction.


eval extracts the buffer object (for the given InternalRow) and evaluates the result.

Aggregation Buffer Attributes

aggBufferAttributes: Seq[AttributeReference]

aggBufferAttributes is part of the AggregateFunction abstraction.


aggBufferAttributes is a single AttributeReference:

Name DataType
buf BinaryType

Extracting Buffer Object

getBufferObject(
  bufferRow: InternalRow): T // (1)!
getBufferObject(
  buffer: InternalRow,
  offset: Int): T
  1. Uses the mutableAggBufferOffset as the offset

getBufferObject requests the given InternalRow for the value (of type T) at the given offset that is of ObjectType type.


getBufferObject is used when:

ObjectType

anyObjectType: ObjectType

When created, TypedImperativeAggregate creates an ObjectType of a value of Scala AnyRef type.

The ObjectType is used in getBufferObject.