Skip to content

add unit test coverage for AggregationOperation #4907

@aglinxinyuan

Description

@aglinxinyuan

AggregationOperation (common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/aggregate/AggregationOperation.scala) has no test coverage today. It is the type that backs every aggregate operator's runtime: result-column typing, type-validation, and the per-kind DistributedAggregation (init/iterate/merge/finalAgg) all live here.

Add a AggregationOperationSpec that pins:

  • getAggregationAttribute per kind: SUM/MIN/MAX preserve the input type, COUNT → INTEGER, AVERAGE → DOUBLE, CONCAT → STRING; null aggFunction throws.
  • getAggFunc validation: SUM/MIN/MAX throw UnsupportedOperationException for non-numeric types; null aggFunction throws.
  • getAggFunc semantics for SUM, COUNT, AVERAGE, CONCAT: init values, iterate accumulation (including null/null-attribute differences for COUNT), merge of partials, and finalAgg projection (including the "average of zero values is null" rule).
  • getFinal: COUNT → SUM over the result column; non-COUNT aggregations keep their kind but rebind attribute → resultAttribute.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions