Skip to main content

AttrPred

Struct AttrPred 

Source
struct AttrPred<'a> {
    op: Op,
    strs: Option<(&'a [u32], Vec<bool>)>,
    ints: Option<(&'a [i64], i64)>,
    doubles: Option<(&'a [f64], f64)>,
    bools: Option<(&'a BooleanArray, bool)>,
}
Expand description

One attribute term with everything that does not depend on the row resolved once: the four value columns downcast, the query scalar canonicalized, and — for the string column — the predicate already evaluated against the dictionary.

This used to be attr_matches, which did all of it per row: two downcast_refs, a String allocation for canon, and a parse::<f64>() on every ordered comparison. That measured 30.9 ns per root row against 6.1 for the allocation-free integer arm, which made an attribute filter fifteen times dearer than a column one on the same block.

Fields§

§op: Op§strs: Option<(&'a [u32], Vec<bool>)>

The str column’s dictionary codes, and which dictionary entries satisfy the predicate.

The same trick as field_filter’s Dictionary arm: attribute values are where telemetry repeats (see crate::schema::ATTRS), so a few hundred string comparisons replace one per row and the row loop never touches string data.

ponytail: evaluated over the whole dictionary, which every key in the table shares — so filtering on a rare key in a block whose values are nearly all distinct pays one comparison per distinct value to reject a handful of rows. The ceiling is a value column with no repetition in it, which is the case its dictionary encoding is already the wrong layout for; the upgrade path is a lazily filled memo over the same array.

§ints: Option<(&'a [i64], i64)>§doubles: Option<(&'a [f64], f64)>§bools: Option<(&'a BooleanArray, bool)>

Implementations§

Source§

impl AttrPred<'_>

Source

fn new<'a>(a: &'a RecordBatch, op: Op, v: &Value) -> AttrPred<'a>

Source

fn test(&self, ty: u8, row: usize) -> bool

Compare one attribute row against the query scalar, dispatching on the stored type rather than on the query’s — the column decides what it is.

Empty, Bytes, Slice and Map are returned in results but not filterable in V0, and a column whose type does not match the schema reads the same way: no match.

Auto Trait Implementations§

§

impl<'a> Freeze for AttrPred<'a>

§

impl<'a> RefUnwindSafe for AttrPred<'a>

§

impl<'a> Send for AttrPred<'a>

§

impl<'a> Sync for AttrPred<'a>

§

impl<'a> Unpin for AttrPred<'a>

§

impl<'a> UnsafeUnpin for AttrPred<'a>

§

impl<'a> UnwindSafe for AttrPred<'a>

Blanket Implementations§

§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more