Skip to content

Investigate and reduce runtime type coercion in aggregates like sum #2447

@alamb

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
There is casting logic in aggregates that handles coercing inputs to aggregates

https://github.com/apache/arrow-datafusion/blob/6b4bbd0/datafusion/physical-expr/src/aggregate/sum.rs#L224-L316

On the surface doing these casts in sum.rs appears to duplicates some non trivial amount of the logic in plan timecoercion -- maybe it would be possible to make this code cleaner / consolidate more of the coercion logic.

Describe the solution you'd like
Ensure types are known prior to executing the aggregate so that the input and aggregate types are known aprior

Describe alternatives you've considered
Not sure (maybe the code is needed, it just "feels" a bit wrong)

Additional context

#2405 (comment)
cc @WinkerDu

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions