pub struct VariantDecimal4 {
integer: i32,
scale: u8,
}Expand description
Represents a 4-byte decimal value in the Variant format.
This struct stores a decimal number using a 32-bit signed integer for the coefficient and an 8-bit unsigned integer for the scale (number of decimal places). Its precision is limited to 9 digits.
For valid precision and scale values, see the Variant specification: https://github.com/apache/parquet-format/blob/87f2c8bf77eefb4c43d0ebaeea1778bd28ac3609/VariantEncoding.md?plain=1#L418-L420
§Example: Create a VariantDecimal4
// Create a value representing the decimal 123.4567
let decimal = VariantDecimal4::try_new(1234567, 4).expect("Failed to create decimal");Fields§
§integer: i32§scale: u8Implementations§
Source§impl VariantDecimal4
impl VariantDecimal4
Sourcepub const MAX_PRECISION: u8 = 9u8
pub const MAX_PRECISION: u8 = 9u8
Maximum number of significant digits (9 for 4-byte decimals)
Source§impl VariantDecimal4
impl VariantDecimal4
Sourcepub fn try_new(integer: i32, scale: u8) -> Result<Self, ArrowError>
pub fn try_new(integer: i32, scale: u8) -> Result<Self, ArrowError>
Attempts to create a new instance of this decimal type, failing if the value is too wide or the scale is too large.
Trait Implementations§
Source§impl Clone for VariantDecimal4
impl Clone for VariantDecimal4
Source§fn clone(&self) -> VariantDecimal4
fn clone(&self) -> VariantDecimal4
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VariantDecimal4
impl Debug for VariantDecimal4
Source§impl Display for VariantDecimal4
impl Display for VariantDecimal4
Source§impl From<VariantDecimal4> for Variant<'_, '_>
impl From<VariantDecimal4> for Variant<'_, '_>
Source§fn from(value: VariantDecimal4) -> Self
fn from(value: VariantDecimal4) -> Self
Converts to this type from the input type.
Source§impl From<VariantDecimal4> for VariantDecimal16
impl From<VariantDecimal4> for VariantDecimal16
Source§fn from(decimal: VariantDecimal4) -> Self
fn from(decimal: VariantDecimal4) -> Self
Converts to this type from the input type.
Source§impl From<VariantDecimal4> for VariantDecimal8
impl From<VariantDecimal4> for VariantDecimal8
Source§fn from(decimal: VariantDecimal4) -> Self
fn from(decimal: VariantDecimal4) -> Self
Converts to this type from the input type.
Source§impl PartialEq for VariantDecimal4
impl PartialEq for VariantDecimal4
Source§impl TryFrom<VariantDecimal16> for VariantDecimal4
impl TryFrom<VariantDecimal16> for VariantDecimal4
Source§impl TryFrom<VariantDecimal8> for VariantDecimal4
impl TryFrom<VariantDecimal8> for VariantDecimal4
Source§impl TryFrom<i32> for VariantDecimal4
impl TryFrom<i32> for VariantDecimal4
Source§impl VariantDecimalType for VariantDecimal4
impl VariantDecimalType for VariantDecimal4
Source§const MAX_PRECISION: u8 = 9u8
const MAX_PRECISION: u8 = 9u8
Maximum number of significant digits this decimal type can represent (9, 18, or 38)
Source§const MAX_UNSCALED_VALUE: i32 = 999_999_999i32
const MAX_UNSCALED_VALUE: i32 = 999_999_999i32
The largest positive unscaled value that fits in
Self::MAX_PRECISION digits.Source§fn try_new(integer: i32, scale: u8) -> Result<Self, ArrowError>
fn try_new(integer: i32, scale: u8) -> Result<Self, ArrowError>
Creates a new decimal value from the given unscaled integer and scale, failing if the
integer’s width, or the requested scale, exceeds
MAX_PRECISION. Read moreimpl Copy for VariantDecimal4
impl StructuralPartialEq for VariantDecimal4
Auto Trait Implementations§
impl Freeze for VariantDecimal4
impl RefUnwindSafe for VariantDecimal4
impl Send for VariantDecimal4
impl Sync for VariantDecimal4
impl Unpin for VariantDecimal4
impl UnwindSafe for VariantDecimal4
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more