WindowedStream

Struct WindowedStream 

Source
pub struct WindowedStream<T> { /* private fields */ }
Expand description

Represents a windowed stream for aggregation operations

Implementations§

Source§

impl<T> WindowedStream<T>
where T: Clone + Send + Sync + 'static,

Source

pub fn aggregate<A, F>(self, init: A, f: F) -> DataStream<A>
where A: Clone + Send + Sync + 'static, F: Fn(A, T) -> A + Send + Sync + 'static,

Aggregate values in the window

Source

pub fn any<F>(self, f: F) -> DataStream<bool>
where F: Fn(&T) -> bool + Send + Sync + 'static,

Source

pub fn all<F>(self, f: F) -> DataStream<bool>
where F: Fn(&T) -> bool + Send + Sync + 'static,

Source

pub fn limit(self, n: usize) -> DataStream<Vec<T>>

Limit the number of values in the window

Source

pub fn tail(self, n: usize) -> DataStream<Vec<T>>

Retain last n values in the window

Source

pub fn sort_by<F>(self, f: F) -> DataStream<Vec<T>>
where F: FnMut(&T, &T) -> Ordering + Send + Sync + 'static,

Sort values in the window

Source

pub fn sort_by_ts(self, order: SortOrder) -> DataStream<Vec<T>>

Sort values in the window by timestamp

Source

pub fn sort_by_ts_asc(self) -> DataStream<Vec<T>>

Sort values in the window by timestamp in ascending order

Source

pub fn sort_by_ts_desc(self) -> DataStream<Vec<T>>

Sort values in the window by timestamp in descending order

Source

pub fn skip(self, n: usize) -> DataStream<Vec<T>>

Skip

Source§

impl<T> WindowedStream<T>
where T: Ord + Clone + Send + Sync + 'static,

Source

pub fn sort(self, ord: SortOrder) -> DataStream<Vec<T>>

Sort values in specified order

Source

pub fn top_k(self, k: usize) -> DataStream<Vec<T>>

Get the top k values in the window, the values are sorted in descending order

Source§

impl<T> WindowedStream<T>
where T: Eq + Hash + Clone + Send + Sync + 'static,

Source

pub fn distinct(self) -> DataStream<HashSet<T>>

Distinct values

Source§

impl<T> WindowedStream<T>
where T: Clone + Send + Sync + 'static,

Source

pub fn distinct_by_key<F, K>(self, f: F) -> DataStream<Vec<T>>
where F: Fn(&T) -> K + Sync + Send + 'static, K: Eq + Hash + Clone + Sync + Send + 'static,

Distinct values by key. When the same key is encountered, the first occurrence of the value is retained

Source

pub fn top_k_by_key<F, K>(self, n: usize, f: F) -> DataStream<Vec<T>>
where F: Fn(&T) -> K + Sync + Send + 'static, K: Ord + Eq + Hash + Clone + Sync + Send + 'static,

Get top k values by key. The values are sorted by key in descending order

Auto Trait Implementations§

§

impl<T> Freeze for WindowedStream<T>

§

impl<T> !RefUnwindSafe for WindowedStream<T>

§

impl<T> Send for WindowedStream<T>

§

impl<T> Sync for WindowedStream<T>

§

impl<T> Unpin for WindowedStream<T>

§

impl<T> !UnwindSafe for WindowedStream<T>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T