CurtHagenlocher commented on code in PR #7098: URL: https://github.com/apache/arrow-rs/pull/7098#discussion_r1947809795
########## arrow-schema/src/datatype.rs: ########## @@ -811,6 +857,12 @@ pub const DECIMAL256_MAX_PRECISION: u8 = 76; /// The maximum scale for [DataType::Decimal256] values pub const DECIMAL256_MAX_SCALE: i8 = 76; +/// The default scale for [DataType::Decimal32] values +pub const DECIMAL32_DEFAULT_SCALE: i8 = 2; + +/// The default scale for [DataType::Decimal64] values +pub const DECIMAL64_DEFAULT_SCALE: i8 = 6; + Review Comment: Ah, I'd picked the default scales mostly arbitrarily. The `DecimalType` contract requires one, and there isn't really any obviously-correct choice. PostgreSQL has a `money` type which is roughly DECIMAL(~18, 2). MSSQL has a `smallmoney` that's ~9, 4 and a `money` that's ~18, 4. Four seems a little big for a 32-bit decimal and a little small for a 64-bit decimal. I'd love to get feedback about these, but also don't know how important they are. As for precision, it's based on the maximum number of decimal digits that can be stored without running into the space limits, just like the existing decimals. The largest `i32` is 2,147,483,647 and that can reliably store 999,999,999 but not 9,999,999,999 -- so the max precision is 9. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
