Skip to content

[BUG] Rounding functions don't work well with values > INT_MAX #1036

@Yury-Fridlyand

Description

@Yury-Fridlyand

What is the bug?

ROUND, FLOOR and CEILING functions don't work well with values > INT_MAX or < -INT_MAX

How can one reproduce the bug?

opensearchsql> select ROUND(9223372036854775807), FLOOR(9223372036854775807), CEILING(9223372036854775807);
fetched rows / total rows = 1/1
+------------------------------+------------------------------+--------------------------------+
| ROUND(9223372036854775807)   | FLOOR(9223372036854775807)   | CEILING(9223372036854775807)   |
|------------------------------+------------------------------+--------------------------------|
| 2147483647                   | 2147483647                   | 2147483647                     |
+------------------------------+------------------------------+--------------------------------+

9223372036854775807 == LONG_MAX
Those functions return INTEGER instead of LONG.

What is the expected behavior?

Functions should return LONG.

What is your host/environment?

2.x @ 21373b9

Do you have any additional context?

Reported on behalf of @kylepbit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions