Struct spark_connect_rs::window::Window
source · pub struct Window { /* private fields */ }
Expand description
Primary utility struct for defining window in DataFrames
Implementations§
source§impl Window
impl Window
sourcepub fn new() -> Window
pub fn new() -> Window
Creates a new empty WindowSpec
sourcepub fn currentRow() -> i64
pub fn currentRow() -> i64
Returns 0
sourcepub fn unboundedFollowing() -> i64
pub fn unboundedFollowing() -> i64
Returns i64::MAX
sourcepub fn unboundedPreceding() -> i64
pub fn unboundedPreceding() -> i64
Returns i64::MIN
sourcepub fn partitionBy<I>(self, cols: I) -> WindowSpecwhere
I: ToVecExpr,
pub fn partitionBy<I>(self, cols: I) -> WindowSpecwhere
I: ToVecExpr,
Creates a WindowSpec with the partitioning defined
sourcepub fn orderBy<I, T>(self, cols: I) -> WindowSpecwhere
T: ToExpr,
I: IntoIterator<Item = T>,
pub fn orderBy<I, T>(self, cols: I) -> WindowSpecwhere
T: ToExpr,
I: IntoIterator<Item = T>,
Creates a WindowSpec with the ordering defined
sourcepub fn rangeBetween(self, start: i64, end: i64) -> WindowSpec
pub fn rangeBetween(self, start: i64, end: i64) -> WindowSpec
Creates a WindowSpec with the frame boundaries defined, from start (inclusive) to end (inclusive).
Both start and end are relative from the current row. For example, “0” means “current row”, while “-1” means one off before the current row, and “5” means the five off after the current row.
Recommended to use Window::unboundedPreceding, Window::unboundedFollowing, and Window::currentRow to specify special boundary values, rather than using integral values directly.
§Example
let window = Window::new()
.partitionBy(col("name"))
.orderBy([col("age")])
.rangeBetween(Window::unboundedPreceding(), Window::currentRow());
let df = df.withColumn("rank", rank().over(window.clone()))
.withColumn("min", min("age").over(window));
sourcepub fn rowsBetween(self, start: i64, end: i64) -> WindowSpec
pub fn rowsBetween(self, start: i64, end: i64) -> WindowSpec
Creates a WindowSpec with the frame boundaries defined, from start (inclusive) to end (inclusive).
Both start and end are relative from the current row. For example, “0” means “current row”, while “-1” means one off before the current row, and “5” means the five off after the current row.
Recommended to use Window::unboundedPreceding, Window::unboundedFollowing, and Window::currentRow to specify special boundary values, rather than using integral values directly.
§Example
let window = Window::new()
.partitionBy(col("name"))
.orderBy([col("age")])
.rowsBetween(Window::unboundedPreceding(), Window::currentRow());
let df = df.withColumn("rank", rank().over(window.clone()))
.withColumn("min", min("age").over(window));
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Window
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnwindSafe for Window
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request