Trait arrow_array::types::DecimalType
source · [−]pub trait DecimalType: 'static + Send + Sync + ArrowPrimitiveType + DecimalTypeSealed {
const BYTE_LENGTH: usize;
const MAX_PRECISION: u8;
const MAX_SCALE: u8;
const TYPE_CONSTRUCTOR: fn(_: u8, _: u8) -> DataType;
const DEFAULT_TYPE: DataType;
fn format_decimal(value: Self::Native, precision: u8, scale: u8) -> String;
fn validate_decimal_precision(
value: Self::Native,
precision: u8
) -> Result<(), ArrowError>;
}
Expand description
A trait over the decimal types, used by DecimalArray
to provide a generic
implementation across the various decimal types
Implemented by Decimal128Type
and Decimal256Type
for Decimal128Array
and Decimal256Array
respectively
Required Associated Constants
const BYTE_LENGTH: usize
const MAX_PRECISION: u8
const MAX_SCALE: u8
const TYPE_CONSTRUCTOR: fn(_: u8, _: u8) -> DataType
const DEFAULT_TYPE: DataType
Required Methods
sourcefn format_decimal(value: Self::Native, precision: u8, scale: u8) -> String
fn format_decimal(value: Self::Native, precision: u8, scale: u8) -> String
Formats the decimal value with the provided precision and scale
sourcefn validate_decimal_precision(
value: Self::Native,
precision: u8
) -> Result<(), ArrowError>
fn validate_decimal_precision(
value: Self::Native,
precision: u8
) -> Result<(), ArrowError>
Validates that value
contains no more than precision
decimal digits