Struct tidb_query_executors::BatchTopNExecutor[][src]

pub struct BatchTopNExecutor<Src: BatchExecutor> {
    heap: BinaryHeap<HeapItemUnsafe>,
    eval_columns_buffer_unsafe: Box<Vec<RpnStackNode<'static>>>,
    order_exprs: Box<[RpnExpression]>,
    order_exprs_field_type: Box<[FieldType]>,
    order_is_desc: Box<[bool]>,
    n: usize,
    context: EvalContext,
    src: Src,
    is_ended: bool,
}

Fields

heap: BinaryHeap<HeapItemUnsafe>

The heap, which contains N rows at most.

This field is placed before eval_columns_buffer_unsafe, order_exprs, order_is_desc and src because it relies on data in those fields and we want this field to be dropped first.

eval_columns_buffer_unsafe: Box<Vec<RpnStackNode<'static>>>

A collection of all evaluated columns. This is to avoid repeated allocations in each next_batch().

DO NOT EVER try to read the content of the elements directly, since it is highly unsafe. The lifetime of elements is not really ’static. Certain elements are valid only if both of the following conditions are satisfied:

  1. BatchTopNExecutor is valid (i.e. not dropped).

  2. The referenced LazyBatchColumnVec of the element must be valid, which only happens when at least one of the row is in the heap. Note that rows may be swapped out from heap at any time.

This field is placed before order_exprs and src because it relies on data in those fields and we want this field to be dropped first.

order_exprs: Box<[RpnExpression]>order_exprs_field_type: Box<[FieldType]>

This field stores the field type of the results evaluated by the exprs in order_exprs.

order_is_desc: Box<[bool]>

Whether or not it is descending order for each order by column.

n: usizecontext: EvalContextsrc: Srcis_ended: bool

Implementations

impl BatchTopNExecutor<Box<dyn BatchExecutor<StorageStats = ()>>>[src]

pub fn check_supported(descriptor: &TopN) -> Result<()>[src]

Checks whether this executor can be used.

impl<Src: BatchExecutor> BatchTopNExecutor<Src>[src]

pub fn new(
    config: Arc<EvalConfig>,
    src: Src,
    order_exprs_def: Vec<Expr>,
    order_is_desc: Vec<bool>,
    n: usize
) -> Result<Self>
[src]

fn handle_next_batch(&mut self) -> Result<Option<LazyBatchColumnVec>>[src]

fn process_batch_input(
    &mut self,
    physical_columns: LazyBatchColumnVec,
    logical_rows: Vec<usize>
) -> Result<()>
[src]

fn heap_add_row(&mut self, row: HeapItemUnsafe) -> Result<()>[src]

fn heap_take_all(&mut self) -> LazyBatchColumnVec[src]

Trait Implementations

impl<Src: BatchExecutor> BatchExecutor for BatchTopNExecutor<Src>[src]

type StorageStats = Src::StorageStats

impl<Src: BatchExecutor> Send for BatchTopNExecutor<Src>[src]

All NonNull pointers in BatchTopNExecutor cannot be accessed out of the struct and BatchTopNExecutor doesn’t leak the pointers to other threads. Therefore, with those NonNull pointers, BatchTopNExecutor still remains Send.

Auto Trait Implementations

impl<Src> !RefUnwindSafe for BatchTopNExecutor<Src>

impl<Src> !Sync for BatchTopNExecutor<Src>

impl<Src> Unpin for BatchTopNExecutor<Src> where
    Src: Unpin

impl<Src> !UnwindSafe for BatchTopNExecutor<Src>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]