Skip to content

avg(decimal) might lose precision and cause an overflow over return type #24369

Description

@AdamGS

Describe the bug

The return type for avg(decimal) is currently Decimal(p + 4, s + 4), saturating at the width's max size.
For columns that have a precision that is close to the variant's maximum precision, the output might not fit into the return type, resulting in an overflow.

To Reproduce

No response

Expected behavior

Averages shouldn't overflow at that last step, especially as this is a predictable output.

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions