Skip to main content

DecisionSchema

Struct DecisionSchema 

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

The Arrow-emission view over a set of questions. Cheap to clone (the questions are shared); the Arrow schema itself is rebuilt on demand so an emitted schema can never drift from the IR.

Implementations§

Source§

impl DecisionSchema

Source

pub fn new(questions: Vec<QuestionSpec>) -> Result<Self, ArrowSchemaError>

Build from validated questions. The conformal-set column is emitted by default (reserved in v1); see DecisionSchema::without_conformal_set.

Source

pub fn from_question_set(set: &QuestionSet) -> Result<Self, ArrowSchemaError>

Build from an authored question set (the state is not part of the columnar contract).

Source

pub fn without_conformal_set(self) -> Self

Omit the reserved conformal-set columns (v1 consumers that do not read them).

Source

pub fn questions(&self) -> &[QuestionSpec]

The questions backing this schema, in canonical order.

Source

pub fn arrow_schema(&self) -> Schema

The Arrow schema. Schema metadata is always empty by construction: labels live in field metadata, calibration parameters in P0.3 tables.

Source

pub fn fingerprint(&self) -> String

A stable content fingerprint over (id, kind, labels) per question plus the conformal-set flag. Registries persist this to detect drift; the hex string is safe to embed in P0.3 rows.

Source

pub fn check_evolution( old: &Self, new: &Self, ) -> Result<EvolutionReport, EvolutionError>

Fail-loud schema evolution check. Adding or removing questions is compatible (reported); changing an existing question’s kind or label set — or flipping conformal-set emission, which changes the emitted column set — is not: mint a new schema version instead. The rejected inputs are exactly the ones DecisionSchema::fingerprint distinguishes.

Source

pub fn build_batch( &self, version: &VersionTriple, rows: &[AnswerRow], ) -> Result<RecordBatch, BatchError>

Encode rows into a record batch under this schema. Every row must carry an answer (possibly abstained) for every declared question; distributions are validated against the producer tolerance (D5).

Trait Implementations§

Source§

impl Clone for DecisionSchema

Source§

fn clone(&self) -> DecisionSchema

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DecisionSchema

Source§

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

Formats the value using the given formatter. 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> 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.
§

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

§

fn vzip(self) -> V

§

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