struct GuaranteeBuilder<'a> {
guarantees: Vec<Option<LiteralGuarantee>>,
map: HashMap<(&'a Column, Guarantee), usize>,
}Expand description
Combines conjuncts (aka terms ANDed together) into LiteralGuarantees,
preserving insert order
Fields§
§guarantees: Vec<Option<LiteralGuarantee>>List of guarantees that have been created so far
if we have determined a subsequent conjunct invalidates a guarantee
e.g. a = foo AND a = bar then the relevant guarantee will be None
map: HashMap<(&'a Column, Guarantee), usize>Key is the (column name, guarantee type)
Value is the index into guarantees
Implementations§
Source§impl<'a> GuaranteeBuilder<'a>
impl<'a> GuaranteeBuilder<'a>
fn new() -> Self
Sourcefn aggregate_conjunct(self, col_op_lit: ColOpLit<'a>) -> Self
fn aggregate_conjunct(self, col_op_lit: ColOpLit<'a>) -> Self
Aggregate a new single AND col <op> literal term to this builder
combining with existing guarantees if possible.
§Examples
AND (a = 1):ais guaranteed to be 1AND (a != 1): a is guaranteed to not be 1
Sourcefn aggregate_multi_conjunct(
self,
col: &'a Column,
guarantee: Guarantee,
new_values: impl IntoIterator<Item = &'a ScalarValue>,
) -> Self
fn aggregate_multi_conjunct( self, col: &'a Column, guarantee: Guarantee, new_values: impl IntoIterator<Item = &'a ScalarValue>, ) -> Self
Aggregates a new single column, multi literal term to this builder combining with previously known guarantees if possible.
§Examples
For the following examples, we can guarantee the expression is true if:
AND (a = 1 OR a = 2 OR a = 3): a is in (1, 2, or 3)AND (a IN (1,2,3)): a is in (1, 2, or 3)AND (a != 1 OR a != 2 OR a != 3): a is not in (1, 2, or 3)AND (a NOT IN (1,2,3)): a is not in (1, 2, or 3)
Sourcefn build(self) -> Vec<LiteralGuarantee>
fn build(self) -> Vec<LiteralGuarantee>
Return all guarantees that have been created so far
Trait Implementations§
Source§impl<'a> Debug for GuaranteeBuilder<'a>
impl<'a> Debug for GuaranteeBuilder<'a>
Source§impl<'a> Default for GuaranteeBuilder<'a>
impl<'a> Default for GuaranteeBuilder<'a>
Source§fn default() -> GuaranteeBuilder<'a>
fn default() -> GuaranteeBuilder<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for GuaranteeBuilder<'a>
impl<'a> !RefUnwindSafe for GuaranteeBuilder<'a>
impl<'a> Send for GuaranteeBuilder<'a>
impl<'a> Sync for GuaranteeBuilder<'a>
impl<'a> Unpin for GuaranteeBuilder<'a>
impl<'a> !UnwindSafe for GuaranteeBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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