Struct tidb_query_executors::top_n_executor::BatchTopNExecutor [−][src]
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:
-
BatchTopNExecutor
is valid (i.e. not dropped). -
The referenced
LazyBatchColumnVec
of the element must be valid, which only happens when at least one of the row is in theheap
. Note that rows may be swapped out fromheap
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: usize
context: EvalContext
src: Src
is_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]
config: Arc<EvalConfig>,
src: Src,
order_exprs_def: Vec<Expr>,
order_is_desc: Vec<bool>,
n: usize
) -> Result<Self>
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]
&mut self,
physical_columns: LazyBatchColumnVec,
logical_rows: Vec<usize>
) -> Result<()>
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
fn schema(&self) -> &[FieldType]
[src]
fn next_batch(&mut self, _scan_rows: usize) -> BatchExecuteResult
[src]
fn collect_exec_stats(&mut self, dest: &mut ExecuteStats)
[src]
fn collect_storage_stats(&mut self, dest: &mut Self::StorageStats)
[src]
fn take_scanned_range(&mut self) -> IntervalRange
[src]
fn can_be_cached(&self) -> bool
[src]
fn collect_summary(
self,
output_index: usize
) -> WithSummaryCollector<ExecSummaryCollectorEnabled, Self> where
Self: Sized,
[src]
self,
output_index: usize
) -> WithSummaryCollector<ExecSummaryCollectorEnabled, Self> where
Self: Sized,
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,
Src: Unpin,
impl<Src> !UnwindSafe for BatchTopNExecutor<Src>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>,
[src]
W: ConvertTo<V>,
pub fn convert_from(ctx: &mut EvalContext, from: W) -> Result<V, Error>
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,