use crate::column::Column;
use crate::error::{CudfError, Result};
use crate::scalar::Scalar;
impl Column {
pub fn extract_year(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::extract_year(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn extract_month(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::extract_month(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn extract_day(&self) -> Result<Column> {
let raw = cudf_cxx::datetime::ffi::extract_day(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn extract_hour(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::extract_hour(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn extract_minute(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::extract_minute(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn extract_second(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::extract_second(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn extract_weekday(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::extract_weekday(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn extract_day_of_year(&self) -> Result<Column> {
let raw = cudf_cxx::datetime::ffi::extract_day_of_year(&self.inner)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn last_day_of_month(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::last_day_of_month(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn add_calendrical_months_scalar(&self, months: &Scalar) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::add_calendrical_months_scalar(&self.inner, &months.inner)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn add_calendrical_months_column(&self, months: &Column) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::add_calendrical_months_column(&self.inner, &months.inner)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn is_leap_year(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::is_leap_year(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn days_in_month(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::days_in_month(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn extract_quarter(&self) -> Result<Column> {
let raw =
cudf_cxx::datetime::ffi::extract_quarter(&self.inner).map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn ceil_datetimes(&self, freq: i32) -> Result<Column> {
let raw = cudf_cxx::datetime::ffi::ceil_datetimes(&self.inner, freq)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn floor_datetimes(&self, freq: i32) -> Result<Column> {
let raw = cudf_cxx::datetime::ffi::floor_datetimes(&self.inner, freq)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
pub fn round_datetimes(&self, freq: i32) -> Result<Column> {
let raw = cudf_cxx::datetime::ffi::round_datetimes(&self.inner, freq)
.map_err(CudfError::from_cxx)?;
Ok(Column { inner: raw })
}
}