Skip to main content

FunctionalDependence

Struct FunctionalDependence 

Source
pub struct FunctionalDependence {
    pub source_indices: Vec<usize>,
    pub target_indices: Vec<usize>,
    pub nullable: bool,
    pub null_equality: NullEquality,
    pub mode: Dependency,
}
Expand description

This object defines a functional dependence in the schema. A functional dependence defines a relationship between determinant keys and dependent columns. A determinant key is a column, or a set of columns, whose value uniquely determines values of some other (dependent) columns. If two rows have the same determinant key, dependent columns in these rows are necessarily the same. If the determinant key is unique, the set of dependent columns is equal to the entire schema and the determinant key can serve as a primary key. Note that a primary key may “downgrade” into a determinant key due to an operation such as a join, and this object is used to track dependence relationships in such cases. For more information on functional dependencies, see: https://www.scaler.com/topics/dbms/functional-dependency-in-dbms/

Fields§

§source_indices: Vec<usize>§target_indices: Vec<usize>§nullable: bool

Flag indicating whether one of the source_indices can receive NULL values. For a data source, if the constraint in question is Constraint::Unique, this flag is true. If the constraint in question is Constraint::PrimaryKey, this flag is false. Note that as the schema changes between different stages in a plan, such as after LEFT JOIN or RIGHT JOIN operations, this property may change.

§null_equality: NullEquality

The NULL-comparison semantics under which this dependency holds. The conservative default, NullEquality::NullEqualsNothing, means it holds only across rows whose determinant contains no NULLs; e.g. a nullable UNIQUE constraint permits multiple NULL rows that may differ. NullEquality::NullEqualsNull means it also holds when NULL determinant values are treated as equal; e.g. a GROUP BY key.

§mode: Dependency

Implementations§

Source§

impl FunctionalDependence

Source

pub fn new( source_indices: Vec<usize>, target_indices: Vec<usize>, nullable: bool, ) -> Self

Source

pub fn with_mode(self, mode: Dependency) -> Self

Source

pub fn with_null_equality(self, null_equality: NullEquality) -> Self

Source

pub fn is_valid_across_nulls(&self, schema: &DFSchema) -> bool

Returns true if this dependency remains usable for operations that treat NULL determinant values as equal (GROUP BY, DISTINCT and sorting, which place all NULL keys together): it must hold under NULLs-are-equal semantics, have a non-nullable determinant (e.g. a PRIMARY KEY), or have no nullable source field in the given schema.

Trait Implementations§

Source§

impl Clone for FunctionalDependence

Source§

fn clone(&self) -> Self

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 FunctionalDependence

Source§

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

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

impl Eq for FunctionalDependence

Source§

impl PartialEq for FunctionalDependence

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FunctionalDependence

Auto Trait Implementations§

Blanket Implementations§

Source§

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

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.