lance_encoding::decoder

Struct DecodeBatchScheduler

Source
pub struct DecodeBatchScheduler {
    pub root_fields: Fields,
    /* private fields */
}
Expand description

The scheduler for decoding batches

Lance decoding is done in two steps, scheduling, and decoding. The scheduling tends to be lightweight and should quickly figure what data is needed from the disk issue the appropriate I/O requests. A decode task is created to eventually decode the data (once it is loaded) and scheduling moves on to scheduling the next page.

Meanwhile, it’s expected that a decode stream will be setup to run at the same time. Decode tasks take the data that is loaded and turn it into Arrow arrays.

This approach allows us to keep our I/O parallelism and CPU parallelism completely separate since those are often two very different values.

Backpressure should be achieved via the I/O service. Requests that are issued will pile up if the decode stream is not polling quickly enough. The crate::EncodingsIo::submit_request function should return a pending future once there are too many I/O requests in flight.

TODO: Implement backpressure

Fields§

§root_fields: Fields

Implementations§

Source§

impl DecodeBatchScheduler

Source

pub async fn try_new<'a>( schema: &'a Schema, column_indices: &[u32], column_infos: &[Arc<ColumnInfo>], file_buffer_positions_and_sizes: &'a Vec<(u64, u64)>, num_rows: u64, _decoder_plugins: Arc<DecoderPlugins>, io: Arc<dyn EncodingsIo>, cache: Arc<FileMetadataCache>, filter: &FilterExpression, ) -> Result<Self>

Creates a new decode scheduler with the expected schema and the column metadata of the file.

Source

pub fn from_scheduler( root_scheduler: Arc<dyn FieldScheduler>, root_fields: Fields, cache: Arc<FileMetadataCache>, ) -> Self

Source

pub fn schedule_ranges_to_vec( &mut self, ranges: &[Range<u64>], filter: &FilterExpression, io: Arc<dyn EncodingsIo>, priority: Option<Box<dyn PriorityRange>>, ) -> Result<Vec<DecoderMessage>>

Source

pub fn schedule_ranges( &mut self, ranges: &[Range<u64>], filter: &FilterExpression, sink: UnboundedSender<Result<DecoderMessage>>, scheduler: Arc<dyn EncodingsIo>, )

Schedules the load of multiple ranges of rows

Ranges must be non-overlapping and in sorted order

§Arguments
  • ranges - The ranges of rows to load
  • sink - A channel to send the decode tasks
  • scheduler An I/O scheduler to issue I/O requests
Source

pub fn schedule_range( &mut self, range: Range<u64>, filter: &FilterExpression, sink: UnboundedSender<Result<DecoderMessage>>, scheduler: Arc<dyn EncodingsIo>, )

Schedules the load of a range of rows

§Arguments
  • range - The range of rows to load
  • sink - A channel to send the decode tasks
  • scheduler An I/O scheduler to issue I/O requests
Source

pub fn schedule_take( &mut self, indices: &[u64], filter: &FilterExpression, sink: UnboundedSender<Result<DecoderMessage>>, scheduler: Arc<dyn EncodingsIo>, )

Schedules the load of selected rows

§Arguments
  • indices - The row indices to load (these must be in ascending order!)
  • sink - A channel to send the decode tasks
  • scheduler An I/O scheduler to issue I/O requests

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T