Skip to content

FLOOR decimal returns unexpected error #20640

Description

@MichaelScofield

Describe the bug

FLOOR('-999.9'::DECIMAL(4,1)) is calculated to "decimal overflow" error.

To Reproduce

./datafusion-cli
DataFusion CLI v52.1.0
> SELECT FLOOR('-999.9'::DECIMAL(4,1));
Arrow error: Compute error: Decimal overflow while applying floor

Expected behavior

Like DuckDB, it should return -1000:

./duckdb
DuckDB v1.4.4 (Andium) 6ddac802ff
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D select floor(-'999.9'::decimal(4,1));
┌─────────────────────────────────────────┐
│ floor(-(CAST('999.9' AS DECIMAL(4,1)))) │
│              decimal(4,0)               │
├─────────────────────────────────────────┤
│                  -1000                  │
└─────────────────────────────────────────┘

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