Skip to content

ceil, floor on decimal can produce spurious overflow #22511

Description

@neilconway

Describe the bug

ceil and floor on decimal inputs can raise a spurious overflow because it reuses the input value's scale and precision.

To Reproduce

> select ceil(CAST(9.9 AS DECIMAL(2,1)));
Arrow error: Compute error: Decimal overflow while applying ceil
> SELECT floor(CAST(-9.9 AS DECIMAL(2,1)));
Arrow error: Compute error: Decimal overflow while applying floor

Expected behavior

The queries should return 10 and -10, respectively, which is what Postgres and DuckDB both do.

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