You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2020/06/27 15:30:11 UTC

[arrow] branch master updated: ARROW-8985: [Format] Add Decimal::bitWidth field with default value of 128 for forward compatibility

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a851b8  ARROW-8985: [Format] Add Decimal::bitWidth field with default value of 128 for forward compatibility
0a851b8 is described below

commit 0a851b87135141e28b2b430b06ffde2e89c2e08d
Author: Wes McKinney <we...@apache.org>
AuthorDate: Sat Jun 27 10:29:41 2020 -0500

    ARROW-8985: [Format] Add Decimal::bitWidth field with default value of 128 for forward compatibility
    
    As discussed and voted on the mailing list [1], this adds a "bit width" field to the Decimal metadata to permit supporting decimal binary representations other than 128-bit while allowing current libraries to reject such differently-sized data if they receive it from a future library version.
    
    [1]: https://s.apache.org/decimal-bit-width
    
    Closes #7321 from wesm/ARROW-8985
    
    Lead-authored-by: Wes McKinney <we...@apache.org>
    Co-authored-by: Wes McKinney <we...@apache.org>
    Signed-off-by: Wes McKinney <we...@apache.org>
---
 format/Schema.fbs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/format/Schema.fbs b/format/Schema.fbs
index 63a80b0..d834f90 100644
--- a/format/Schema.fbs
+++ b/format/Schema.fbs
@@ -134,11 +134,22 @@ table FixedSizeBinary {
 table Bool {
 }
 
+/// Exact decimal value represented as an integer value in two's
+/// complement. Currently only 128-bit (16-byte) integers are used but this may
+/// be expanded in the future. The representation uses the endianness indicated
+/// in the Schema.
 table Decimal {
   /// Total number of decimal digits
   precision: int;
+
   /// Number of digits after the decimal point "."
   scale: int;
+
+  /// Number of bits per value. The only accepted width right now is 128 but
+  /// this field exists for forward compatibility so that other bit widths may
+  /// be supported in future format versions. We use bitWidth for consistency
+  /// with Int::bitWidth.
+  bitWidth: int = 128;
 }
 
 enum DateUnit: short {