apache / apache/datafusion

Hashed Aggregator panics when aggregate fn returns an error

Open
#4,315 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

**Describe the bug**
A clear and concise description of what the bug is.

The hash aggregator panics when any of the aggregators returns an error.
https://github.com/apache/arrow-datafusion/blob/master/datafusion/core/src/physical_plan/aggregates/hash.rs#L443

**To Reproduce**
Steps to reproduce the behavior:

Try to calculate the variance of an array of length 1. The current implementation of variance will return an `Err` which will cause the linked code above to panic.

**Expected behavior**
A clear and concise description of what you expected to happen.

Errors should be returned, they should not be unwrapped and cause a panic.

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start in datafusion/core/src/physical_plan/aggregates/hash.rs at the linked line where the aggregate result is handled. Reproduce the issue by calculating variance for an array of length 1, whose aggregate returns an error. Done means the error is returned to the caller instead of causing a panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.