pub struct DistinctResult { /* private fields */ }Expand description
Streaming distinct result that removes duplicate rows on-the-fly
This streams rows and only stores seen row values for deduplication. This enables:
- Early termination with LIMIT (no need to scan all rows)
- Lower latency to first row
- Streaming output
Implementations§
Source§impl DistinctResult
impl DistinctResult
Sourcepub fn new(inner: Box<dyn QueryResult>) -> Self
pub fn new(inner: Box<dyn QueryResult>) -> Self
Create a new streaming distinct result
Sourcepub fn with_column_count(
inner: Box<dyn QueryResult>,
distinct_columns: Option<usize>,
) -> Self
pub fn with_column_count( inner: Box<dyn QueryResult>, distinct_columns: Option<usize>, ) -> Self
Create a distinct result that only considers the first distinct_columns columns
for uniqueness comparison. This is used when ORDER BY references columns not in SELECT.
For example: SELECT DISTINCT a FROM t ORDER BY b
- The result has columns [a, b] for sorting
- But distinctness should only compare column [a]
Trait Implementations§
Source§impl QueryResult for DistinctResult
impl QueryResult for DistinctResult
Source§fn scan(&self, dest: &mut [Value]) -> Result<()>
fn scan(&self, dest: &mut [Value]) -> Result<()>
Scans the current row into the provided values Read more
Source§fn rows_affected(&self) -> i64
fn rows_affected(&self) -> i64
Returns the number of rows affected by an INSERT, UPDATE, or DELETE Read more
Source§fn last_insert_id(&self) -> i64
fn last_insert_id(&self) -> i64
Returns the last inserted ID for an INSERT operation Read more
Source§fn with_aliases(
self: Box<Self>,
aliases: FxHashMap<String, String>,
) -> Box<dyn QueryResult>
fn with_aliases( self: Box<Self>, aliases: FxHashMap<String, String>, ) -> Box<dyn QueryResult>
Sets column aliases for this result Read more
Source§fn columns_arc(&self) -> Option<CompactArc<Vec<String>>>
fn columns_arc(&self) -> Option<CompactArc<Vec<String>>>
Returns column names as Arc for zero-copy sharing Read more
Source§fn try_into_arc_rows(&mut self) -> Option<CompactArc<Vec<Row>>>
fn try_into_arc_rows(&mut self) -> Option<CompactArc<Vec<Row>>>
Try to extract all rows as CompactArc<Vec> for zero-copy joins Read more
Auto Trait Implementations§
impl Freeze for DistinctResult
impl !RefUnwindSafe for DistinctResult
impl Send for DistinctResult
impl !Sync for DistinctResult
impl Unpin for DistinctResult
impl !UnwindSafe for DistinctResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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