Skip to content

SQL: ROUND(NaN) results in -0.0 #65863

@palesz

Description

@palesz

The following SQL query:

SELECT ROUND('NaN'::double)

results in:

ROUND('NaN'::double)
--------------------
-0.0                

Other major relational DBs behave differently.

MySQL and MSSQL does not have NaN (only NULL ), ROUND(NULL) is NULL.
PostgreSQL and Oracle has NaN and ROUND(NaN) returns NaN.

Was it intentional that we kept this in-sync with the Math.round() behaviour and different from the relational DBs above?

Note: H2 (that we check against in integration tests) also follows the behaviour of Math.round().

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/SQLSQL querying>bugTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions