pub struct ColumnDecimal { /* private fields */ }Expand description
Column for Decimal types with precision and scale Stores values as integers (scaled by 10^scale)
Uses efficient internal representation based on precision:
- precision <= 9: ColumnInt32 (4 bytes per value)
- precision <= 18: ColumnInt64 (8 bytes per value)
- precision > 18: ColumnInt128 (16 bytes per value)
Implementations§
Source§impl ColumnDecimal
impl ColumnDecimal
Sourcepub fn new(type_: Type) -> Self
pub fn new(type_: Type) -> Self
Create a new empty decimal column for the given Decimal type.
§Panics
Panics if type_ is not a Type::Decimal.
Sourcepub fn with_data(self, data: Vec<i128>) -> Self
pub fn with_data(self, data: Vec<i128>) -> Self
Set the column data from a vector of raw scaled i128 values.
Sourcepub fn append_from_string(&mut self, s: &str) -> Result<()>
pub fn append_from_string(&mut self, s: &str) -> Result<()>
Append a decimal value parsed from a string like "123.45".
§Errors
Returns an error if the string is not a valid decimal or the fractional part exceeds the column’s scale.
Sourcepub fn precision(&self) -> usize
pub fn precision(&self) -> usize
Returns the precision (total number of digits) of this decimal column.
Trait Implementations§
Source§impl Column for ColumnDecimal
impl Column for ColumnDecimal
Source§fn column_type(&self) -> &Type
fn column_type(&self) -> &Type
Get the type of this column
Source§fn append_column(&mut self, other: ColumnRef) -> Result<()>
fn append_column(&mut self, other: ColumnRef) -> Result<()>
Append another column’s data to this column
Source§fn load_from_buffer(&mut self, buffer: &mut &[u8], rows: usize) -> Result<()>
fn load_from_buffer(&mut self, buffer: &mut &[u8], rows: usize) -> Result<()>
Load column data from byte buffer
Source§fn clone_empty(&self) -> ColumnRef
fn clone_empty(&self) -> ColumnRef
Create an empty clone of this column (same type, no data)
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Downcast to a mutable concrete column type
Auto Trait Implementations§
impl Freeze for ColumnDecimal
impl !RefUnwindSafe for ColumnDecimal
impl Send for ColumnDecimal
impl Sync for ColumnDecimal
impl Unpin for ColumnDecimal
impl !UnwindSafe for ColumnDecimal
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