Skip to content

ROUND support decimal #17054

@mmooyyii

Description

@mmooyyii

Is your feature request related to a problem or challenge?

When using round(value::decimal) in datafusion, the decimal will implicit cast to float64 and round returns float64.
It may lose decimal's precision.
I think round support decimal can make calculations safer

> select round('173975140545.855'::decimal(38,10),2);
+------------------------------------------+
| round(Utf8("173975140545.855"),Int64(2)) |
+------------------------------------------+
| 173975140545.85                          |
+------------------------------------------+
1 row(s) fetched. 
Elapsed 0.001 seconds.

same SQL in postgreSQL

postgres=# select round('173975140545.855'::decimal(38,10),2);
      round      
-----------------
 173975140545.86

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions