Struct VariantDecimal4
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§
§impl VariantDecimal4
impl VariantDecimal4
pub const MAX_PRECISION: u8 = 9u8
pub const MAX_PRECISION: u8 = 9u8
Maximum number of significant digits (9 for 4-byte decimals)
§impl VariantDecimal4
impl VariantDecimal4
pub fn try_new(integer: i32, scale: u8) -> Result<VariantDecimal4, ArrowError>
pub fn try_new(integer: i32, scale: u8) -> Result<VariantDecimal4, 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§
§impl Clone for VariantDecimal4
impl Clone for VariantDecimal4
§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 more§impl Debug for VariantDecimal4
impl Debug for VariantDecimal4
§impl Display for VariantDecimal4
impl Display for VariantDecimal4
§impl From<VariantDecimal4> for Variant<'_, '_>
impl From<VariantDecimal4> for Variant<'_, '_>
§fn from(value: VariantDecimal4) -> Variant<'_, '_>
fn from(value: VariantDecimal4) -> Variant<'_, '_>
Converts to this type from the input type.
§impl From<VariantDecimal4> for VariantDecimal16
impl From<VariantDecimal4> for VariantDecimal16
§fn from(decimal: VariantDecimal4) -> VariantDecimal16
fn from(decimal: VariantDecimal4) -> VariantDecimal16
Converts to this type from the input type.
§impl From<VariantDecimal4> for VariantDecimal8
impl From<VariantDecimal4> for VariantDecimal8
§fn from(decimal: VariantDecimal4) -> VariantDecimal8
fn from(decimal: VariantDecimal4) -> VariantDecimal8
Converts to this type from the input type.
§impl PartialEq for VariantDecimal4
impl PartialEq for VariantDecimal4
§impl TryFrom<VariantDecimal16> for VariantDecimal4
impl TryFrom<VariantDecimal16> for VariantDecimal4
§fn try_from(decimal: VariantDecimal16) -> Result<VariantDecimal4, ArrowError>
fn try_from(decimal: VariantDecimal16) -> Result<VariantDecimal4, ArrowError>
Performs the conversion.
§impl TryFrom<VariantDecimal8> for VariantDecimal4
impl TryFrom<VariantDecimal8> for VariantDecimal4
§fn try_from(decimal: VariantDecimal8) -> Result<VariantDecimal4, ArrowError>
fn try_from(decimal: VariantDecimal8) -> Result<VariantDecimal4, ArrowError>
Performs the conversion.
§impl TryFrom<i32> for VariantDecimal4
impl TryFrom<i32> for VariantDecimal4
§impl VariantDecimalType for VariantDecimal4
impl VariantDecimalType for VariantDecimal4
§const MAX_PRECISION: u8 = 9u8
const MAX_PRECISION: u8 = 9u8
Maximum number of significant digits this decimal type can represent (9, 18, or 38)
§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.§fn try_new(integer: i32, scale: u8) -> Result<VariantDecimal4, ArrowError>
fn try_new(integer: i32, scale: u8) -> Result<VariantDecimal4, 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 more§fn try_new_with_signed_scale(
integer: i32,
scale: i8,
) -> Result<VariantDecimal4, ArrowError>
fn try_new_with_signed_scale( integer: i32, scale: i8, ) -> Result<VariantDecimal4, ArrowError>
Attempts to convert an unscaled arrow decimal value to the indicated variant decimal type. Read more
impl 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more