pub struct DistinctOnIterator<I: RowIterator> { /* private fields */ }Expand description
Iterator that implements SELECT DISTINCT ON (expr, ...).
The input is first sorted by the complete effective sort specification the
planner synthesized (ON keys, user ORDER BY tail, and an all-column
tie-breaker; see docs/sql-distinct-on.md D2-D4). Sorting reuses
SortIterator, so spill runs are merged under the same full comparator
and determinism survives external sorting. The iterator then emits only
the first row of each group whose leading key_count sort keys compare
equal; NULL keys compare equal to NULL (D5).
Implementations§
Source§impl<I: RowIterator> DistinctOnIterator<I>
impl<I: RowIterator> DistinctOnIterator<I>
Sourcepub fn new(
input: I,
order_by: &[SortExpr],
key_count: usize,
policy: Option<MemoryPolicy>,
) -> Result<Self>
pub fn new( input: I, order_by: &[SortExpr], key_count: usize, policy: Option<MemoryPolicy>, ) -> Result<Self>
Creates a new DISTINCT ON iterator.
order_by is the complete effective sort specification whose leading
key_count entries form the distinctness key.
§Errors
Returns an error if sorting the input fails.
Trait Implementations§
Source§impl<I: RowIterator> RowIterator for DistinctOnIterator<I>
impl<I: RowIterator> RowIterator for DistinctOnIterator<I>
Auto Trait Implementations§
impl<I> !RefUnwindSafe for DistinctOnIterator<I>
impl<I> !Send for DistinctOnIterator<I>
impl<I> !Sync for DistinctOnIterator<I>
impl<I> !UnwindSafe for DistinctOnIterator<I>
impl<I> Freeze for DistinctOnIterator<I>where
SortIterator<I>: Freeze,
impl<I> Unpin for DistinctOnIterator<I>where
SortIterator<I>: Unpin,
impl<I> UnsafeUnpin for DistinctOnIterator<I>where
SortIterator<I>: UnsafeUnpin,
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