Trait tantivy_columnar::column_values::ColumnValues

source ·
pub trait ColumnValues<T: PartialOrd = u64>: Send + Sync + DowncastSync {
    // Required methods
    fn get_val(&self, idx: u32) -> T;
    fn min_value(&self) -> T;
    fn max_value(&self) -> T;
    fn num_vals(&self) -> u32;

    // Provided methods
    fn get_vals(&self, indexes: &[u32], output: &mut [T]) { ... }
    fn get_vals_opt(&self, indexes: &[u32], output: &mut [Option<T>]) { ... }
    fn get_range(&self, start: u64, output: &mut [T]) { ... }
    fn get_row_ids_for_value_range(
        &self,
        value_range: RangeInclusive<T>,
        row_id_range: Range<RowId>,
        row_id_hits: &mut Vec<RowId>
    ) { ... }
    fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = T> + 'a> { ... }
}
Expand description

ColumnValues provides access to a dense field column.

Column are just a wrapper over ColumnValues and a ColumnIndex.

Any methods with a default and specialized implementation need to be called in the wrappers that implement the trait: Arc and MonotonicMappingColumn

Required Methods§

source

fn get_val(&self, idx: u32) -> T

Return the value associated with the given idx.

This accessor should return as fast as possible.

§Panics

May panic if idx is greater than the column length.

source

fn min_value(&self) -> T

Returns a lower bound for this column of values.

All values are guaranteed to be higher than .min_value() but this value is not necessary the best boundary value.

We have ∀i < self.num_vals(), self.get_val(i) >= self.min_value() But we don’t have necessarily ∃i < self.num_vals(), self.get_val(i) == self.min_value()

source

fn max_value(&self) -> T

Returns an upper bound for this column of values.

All values are guaranteed to be lower than .max_value() but this value is not necessary the best boundary value.

We have ∀i < self.num_vals(), self.get_val(i) <= self.max_value() But we don’t have necessarily ∃i < self.num_vals(), self.get_val(i) == self.max_value()

source

fn num_vals(&self) -> u32

The number of values in the column.

Provided Methods§

source

fn get_vals(&self, indexes: &[u32], output: &mut [T])

Allows to push down multiple fetch calls, to avoid dynamic dispatch overhead.

idx and output should have the same length

§Panics

May panic if idx is greater than the column length.

source

fn get_vals_opt(&self, indexes: &[u32], output: &mut [Option<T>])

Allows to push down multiple fetch calls, to avoid dynamic dispatch overhead. The slightly weird Option<T> in output allows pushdown to full columns.

idx and output should have the same length

§Panics

May panic if idx is greater than the column length.

source

fn get_range(&self, start: u64, output: &mut [T])

Fills an output buffer with the fast field values associated with the DocId going from start to start + output.len().

§Panics

Must panic if start + output.len() is greater than the segment’s maxdoc.

source

fn get_row_ids_for_value_range( &self, value_range: RangeInclusive<T>, row_id_range: Range<RowId>, row_id_hits: &mut Vec<RowId> )

Get the row ids of values which are in the provided value range.

Note that position == docid for single value fast fields

source

fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = T> + 'a>

Returns a iterator over the data

Implementations§

source§

impl<T> dyn ColumnValues<T>
where T: Any + 'static + PartialOrd,

source

pub fn is<__T: ColumnValues<T>>(&self) -> bool

Returns true if the trait object wraps an object of type __T.

source

pub fn downcast<__T: ColumnValues<T>>( self: Box<Self> ) -> Result<Box<__T>, Box<Self>>

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

source

pub fn downcast_rc<__T: ColumnValues<T>>( self: Rc<Self> ) -> Result<Rc<__T>, Rc<Self>>

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

source

pub fn downcast_ref<__T: ColumnValues<T>>(&self) -> Option<&__T>

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

source

pub fn downcast_mut<__T: ColumnValues<T>>(&mut self) -> Option<&mut __T>

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

source

pub fn downcast_arc<__T: ColumnValues<T> + Any + Send + Sync>( self: Arc<Self> ) -> Result<Arc<__T>, Arc<Self>>

Returns an Arc-ed object from an Arc-ed trait object if the underlying object is of type __T. Returns the original Arc-ed trait if it isn’t.

Implementations on Foreign Types§

source§

impl<T: Copy + PartialOrd + Debug + 'static> ColumnValues<T> for Arc<dyn ColumnValues<T>>

source§

fn get_val(&self, idx: u32) -> T

source§

fn get_vals_opt(&self, indexes: &[u32], output: &mut [Option<T>])

source§

fn min_value(&self) -> T

source§

fn max_value(&self) -> T

source§

fn num_vals(&self) -> u32

source§

fn iter<'b>(&'b self) -> Box<dyn Iterator<Item = T> + 'b>

source§

fn get_range(&self, start: u64, output: &mut [T])

source§

fn get_row_ids_for_value_range( &self, range: RangeInclusive<T>, doc_id_range: Range<u32>, positions: &mut Vec<u32> )

Implementors§