Skip to content

Decimal multiply kernel may cause precision loss #5674

@viirya

Description

@viirya

Describe the bug

Currently decimal multiply kernel (multiply_dyn_decimal) sets original scale by a divide operation. It tries to restore the scale assuming lhs and rhs have the same scale. For example, multiply two decimals (-491, -591) with precision/scale (5, 2), it will divide 290181 by 2 to get the result 29.01 with same precision/scale (5, 2). But by doing this, it loses decimal precision. For example, in Spark, the answer is 29.0181 with precision/scale (11, 4).

To Reproduce

Expected behavior

I'd expect that it behaves like Spark as mentioned above.

Additional context

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions