In order to deal to support use cases where a decimal value has to be downscaled to fit into existing decimal schema with a certain scale, it is useful to allow users to downscale there decimals. The propose is to add a function with the following signature:
decimalFromNumberWithScale(decimal, scale)
For more context about why such method is needed, check the example below:
Given the following schema
{
"name": "v2",
"type": [
"null",
{
"type": "bytes",
"logicalType": "decimal",
"precision": 4,
"scale": 3
}
]
}
The user can send a deceased scale value like 1.3, however increasing the scale by sending a value like 1.33499 would fail with
org.apache.avro.AvroTypeException: Cannot encode decimal with scale 5 as scale 3 without rounding in field v2
(for more details, check: #69 (comment))
In order to deal to support use cases where a decimal value has to be downscaled to fit into existing decimal schema with a certain scale, it is useful to allow users to downscale there decimals. The propose is to add a function with the following signature:
For more context about why such method is needed, check the example below:
Given the following schema
{ "name": "v2", "type": [ "null", { "type": "bytes", "logicalType": "decimal", "precision": 4, "scale": 3 } ] }The user can send a deceased scale value like 1.3, however increasing the scale by sending a value like 1.33499 would fail with
(for more details, check: #69 (comment))