Skip to main content

Distinct

Struct Distinct 

Source
pub struct Distinct<'a> { /* private fields */ }
Expand description

Stable SQL duplicate elimination.

With no key expressions, the complete positional output row is the key. With expressions, the operator implements DISTINCT ON: it preserves the first row for each evaluated key in child order.

Implementations§

Source§

impl<'a> Distinct<'a>

Source

pub fn all(child: Box<dyn PhysicalOperator + 'a>) -> Self

Construct a bounded full-row DISTINCT with the compatibility default work-memory budget.

Source

pub fn all_with_work_mem( child: Box<dyn PhysicalOperator + 'a>, work_mem_bytes: usize, ) -> Self

Construct a bounded full-row DISTINCT with an explicit byte budget.

Source

pub fn on( child: Box<dyn PhysicalOperator + 'a>, keys: Vec<ScalarExpr>, evaluator: SharedExpressionEvaluator<'a>, ) -> Self

Construct a bounded DISTINCT ON with the compatibility default work-memory budget.

Source

pub fn on_with_work_mem( child: Box<dyn PhysicalOperator + 'a>, keys: Vec<ScalarExpr>, evaluator: SharedExpressionEvaluator<'a>, work_mem_bytes: usize, ) -> Self

Construct a bounded DISTINCT ON with an explicit byte budget.

Source

pub fn with_spill_directory(self, directory: impl Into<PathBuf>) -> Self

Place the exact-set files in a caller-selected temporary-data directory. The directory must already exist; a private child directory is created lazily on the first spill and removed through RAII.

Source

pub fn has_spilled(&self) -> bool

Whether this invocation has migrated its key set to disk.

Source

pub fn in_memory_key_bytes(&self) -> usize

Exact encoded key bytes retained by the in-memory set.

Source

pub fn spill_path(&self) -> Option<&Path>

Live private spill directory, for diagnostics and cleanup tests.

Trait Implementations§

Source§

impl PhysicalOperator for Distinct<'_>

Source§

fn row_schema(&self) -> &RowSchema

Complete logical-to-physical row layout emitted by this operator. Every Batch returned by Self::next must carry this exact schema; operators must reject a child that violates that invariant.
Source§

fn open(&mut self) -> ExecResult<()>

Source§

fn next(&mut self) -> ExecResult<Option<Batch>>

Source§

fn close(&mut self) -> ExecResult<()>

Source§

fn schema(&self) -> &[String]

Schema column names in logical output order.
Source§

fn estimated_cardinality(&self) -> Option<u64>

Planner/runtime cardinality estimate for choosing physical strategies. None means the operator cannot provide a useful estimate. The value is advisory rather than a correctness bound.
Source§

fn output_ordering(&self) -> &[PhysicalOrder]

Leading output ordering known to be preserved by this operator.
Source§

fn consume_into_aggregate( &mut self, _executor: &mut dyn AggregateExecutor, ) -> ExecResult<bool>

Let a leaf consume its native projected rows directly into an aggregate executor. Returning false promises that no input was consumed, so the caller can fall back to ordinary Batch pulls.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Distinct<'a>

§

impl<'a> !Sync for Distinct<'a>

§

impl<'a> !UnwindSafe for Distinct<'a>

§

impl<'a> Freeze for Distinct<'a>

§

impl<'a> Send for Distinct<'a>

§

impl<'a> Unpin for Distinct<'a>

§

impl<'a> UnsafeUnpin for Distinct<'a>

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.