CubeSchema

Struct CubeSchema 

Source
pub struct CubeSchema { /* private fields */ }
Expand description

Schema metadata for an ElastiCube

Contains all metadata about dimensions, measures, and hierarchies, providing a semantic layer over the raw Arrow data.

Implementations§

Source§

impl CubeSchema

Source

pub fn new(name: impl Into<String>) -> Self

Create a new cube schema

Source

pub fn name(&self) -> &str

Get the cube name

Source

pub fn description(&self) -> Option<&str>

Get the description

Source

pub fn set_description(&mut self, description: impl Into<String>)

Set the description

Source

pub fn add_dimension(&mut self, dimension: Dimension) -> Result<()>

Add a dimension to the schema

Source

pub fn add_measure(&mut self, measure: Measure) -> Result<()>

Add a measure to the schema

Source

pub fn add_hierarchy(&mut self, hierarchy: Hierarchy) -> Result<()>

Add a hierarchy to the schema

Source

pub fn dimensions(&self) -> Vec<&Dimension>

Get all dimensions

Source

pub fn measures(&self) -> Vec<&Measure>

Get all measures

Source

pub fn hierarchies(&self) -> Vec<&Hierarchy>

Get all hierarchies

Source

pub fn get_dimension(&self, name: &str) -> Option<&Dimension>

Get a dimension by name

Source

pub fn get_dimension_mut(&mut self, name: &str) -> Option<&mut Dimension>

Get a mutable dimension by name

Source

pub fn get_measure(&self, name: &str) -> Option<&Measure>

Get a measure by name

Source

pub fn get_measure_mut(&mut self, name: &str) -> Option<&mut Measure>

Get a mutable measure by name

Source

pub fn get_hierarchy(&self, name: &str) -> Option<&Hierarchy>

Get a hierarchy by name

Source

pub fn remove_dimension(&mut self, name: &str) -> Result<Dimension>

Remove a dimension

Source

pub fn remove_measure(&mut self, name: &str) -> Result<Measure>

Remove a measure

Source

pub fn remove_hierarchy(&mut self, name: &str) -> Result<Hierarchy>

Remove a hierarchy

Source

pub fn dimension_count(&self) -> usize

Get the number of dimensions

Source

pub fn measure_count(&self) -> usize

Get the number of measures

Source

pub fn hierarchy_count(&self) -> usize

Get the number of hierarchies

Source

pub fn has_dimension(&self, name: &str) -> bool

Check if a dimension exists

Source

pub fn has_measure(&self, name: &str) -> bool

Check if a measure exists

Source

pub fn has_hierarchy(&self, name: &str) -> bool

Check if a hierarchy exists

Source

pub fn dimension_names(&self) -> Vec<&str>

Get all dimension names

Source

pub fn measure_names(&self) -> Vec<&str>

Get all measure names

Source

pub fn hierarchy_names(&self) -> Vec<&str>

Get all hierarchy names

Source

pub fn add_calculated_measure( &mut self, calc_measure: CalculatedMeasure, ) -> Result<()>

Add a calculated measure to the schema

Source

pub fn add_virtual_dimension( &mut self, virtual_dim: VirtualDimension, ) -> Result<()>

Add a virtual dimension to the schema

Source

pub fn calculated_measures(&self) -> Vec<&CalculatedMeasure>

Get all calculated measures

Source

pub fn virtual_dimensions(&self) -> Vec<&VirtualDimension>

Get all virtual dimensions

Source

pub fn get_calculated_measure(&self, name: &str) -> Option<&CalculatedMeasure>

Get a calculated measure by name

Source

pub fn get_virtual_dimension(&self, name: &str) -> Option<&VirtualDimension>

Get a virtual dimension by name

Source

pub fn remove_calculated_measure( &mut self, name: &str, ) -> Result<CalculatedMeasure>

Remove a calculated measure

Source

pub fn remove_virtual_dimension( &mut self, name: &str, ) -> Result<VirtualDimension>

Remove a virtual dimension

Source

pub fn has_calculated_measure(&self, name: &str) -> bool

Check if a calculated measure exists

Source

pub fn has_virtual_dimension(&self, name: &str) -> bool

Check if a virtual dimension exists

Source

pub fn calculated_measure_count(&self) -> usize

Get the number of calculated measures

Source

pub fn virtual_dimension_count(&self) -> usize

Get the number of virtual dimensions

Source

pub fn to_arrow_schema(&self) -> Schema

Convert CubeSchema to Arrow Schema

Creates an Arrow schema containing fields for all dimensions and measures. The order is: dimensions first (in insertion order), then measures.

Trait Implementations§

Source§

impl Clone for CubeSchema

Source§

fn clone(&self) -> CubeSchema

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CubeSchema

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CubeSchema

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CubeSchema

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,