You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/content/en/docs/++version++/Specification/_index.md
+5-3
Original file line number
Diff line number
Diff line change
@@ -787,6 +787,8 @@ A logical type is always serialized using its underlying Avro type so that value
787
787
Language implementations must ignore unknown logical types when reading, and should use the underlying Avro type. If a logical type is invalid, for example a decimal with scale greater than its precision, then implementations should ignore the logical type and use the underlying Avro type.
788
788
789
789
### Decimal
790
+
791
+
#### Fixed precision
790
792
The `decimal` logical type represents an arbitrary-precision signed decimal number of the form _unscaled × 10<sup>-scale</sup>_.
791
793
792
794
A `decimal` logical type annotates Avro _bytes_ or _fixed_ types. The byte array must contain the two's-complement representation of the unscaled integer value in big-endian byte order. The scale is fixed, and is specified using an attribute.
@@ -810,19 +812,19 @@ Scale must be zero or a positive integer less than or equal to the precision.
810
812
811
813
For the purposes of schema resolution, two schemas that are `decimal` logical types _match_ if their scales and precisions match.
812
814
813
-
**alternative**
815
+
#### Scalable precision
814
816
815
817
As it's not always possible to fix scale and precision in advance for a decimal field, `big-decimal` is another `decimal` logical type restrict to Avro _bytes_.
816
818
817
-
_Currently only available in Java and Rust_.
819
+
_Currently only available in C++, Java and Rust_.
818
820
819
821
```json
820
822
{
821
823
"type": "bytes",
822
824
"logicalType": "big-decimal"
823
825
}
824
826
```
825
-
Here, as scale property is stored in value itself it needs more bytes than preceding `decimal` type, but it allows more flexibility.
827
+
Here, bytes array contains two serialized properties. First part is an Avro byte arrays which is the two's-complement representation of the unscaled integer value in big-endian byte order. The second part is the scale property stored as an Avro integer. Scale must be zero or a positive integer less than or equal to the precision. Value itself needs more bytes than preceding `decimal` type, but it allows more flexibility.
0 commit comments