Skip to content

Commit

Permalink
feat: decimal series base
Browse files Browse the repository at this point in the history
  • Loading branch information
plaflamme committed Feb 3, 2023
1 parent 199f39c commit bd7ed40
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
14 changes: 14 additions & 0 deletions polars/polars-core/src/chunked_array/logical/decimal.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use super::*;
use crate::prelude::*;

pub type DecimalChunked = Logical<DatetimeType, Int128Type>;

impl LogicalType for DecimalChunked {
fn dtype(&self) -> &DataType {
self.2.as_ref().unwrap()
}

fn cast(&self, dtype: &DataType) -> PolarsResult<Series> {
todo!()
}
}
4 changes: 4 additions & 0 deletions polars/polars-core/src/chunked_array/logical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ pub use date::*;
mod datetime;
#[cfg(feature = "dtype-datetime")]
pub use datetime::*;
#[cfg(feature = "dtype-i128")]
mod decimal;
#[cfg(feature = "dtype-i128")]
pub use decimal::*;
#[cfg(feature = "dtype-duration")]
mod duration;
#[cfg(feature = "dtype-duration")]
Expand Down
64 changes: 64 additions & 0 deletions polars/polars-core/src/series/implementations/decimal.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
use super::{private, IntoSeries, SeriesTrait, SeriesWrap, *};
use crate::prelude::*;

unsafe impl IntoSeries for DecimalChunked {
fn into_series(self) -> Series {
Series(Arc::new(SeriesWrap(self)))
}
}

impl private::PrivateSeriesNumeric for SeriesWrap<DecimalChunked> {}

impl private::PrivateSeries for SeriesWrap<DecimalChunked> {}

impl SeriesTrait for SeriesWrap<DecimalChunked> {
fn rename(&mut self, name: &str) {
todo!()
}

fn chunks(&self) -> &Vec<ArrayRef> {
todo!()
}

fn take_iter(&self, _iter: &mut dyn TakeIterator) -> PolarsResult<Series> {
todo!()
}

unsafe fn take_iter_unchecked(&self, _iter: &mut dyn TakeIterator) -> Series {
todo!()
}

unsafe fn take_unchecked(&self, _idx: &IdxCa) -> PolarsResult<Series> {
todo!()
}

unsafe fn take_opt_iter_unchecked(&self, _iter: &mut dyn TakeIteratorNulls) -> Series {
todo!()
}

fn take(&self, _indices: &IdxCa) -> PolarsResult<Series> {
todo!()
}

fn len(&self) -> usize {
todo!()
}

fn take_every(&self, n: usize) -> Series {
todo!()
}

fn has_validity(&self) -> bool {
todo!()
}

#[cfg(feature = "chunked_ids")]
unsafe fn _take_chunked_unchecked(&self, by: &[ChunkId], sorted: IsSorted) -> Series {
todo!()
}

#[cfg(feature = "chunked_ids")]
unsafe fn _take_opt_chunked_unchecked(&self, by: &[Option<ChunkId>]) -> Series {
todo!()
}
}
2 changes: 2 additions & 0 deletions polars/polars-core/src/series/implementations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ mod categorical;
mod dates_time;
#[cfg(feature = "dtype-datetime")]
mod datetime;
#[cfg(feature = "dtype-i128")]
mod decimal;
#[cfg(feature = "dtype-duration")]
mod duration;
mod floats;
Expand Down

0 comments on commit bd7ed40

Please sign in to comment.