pub struct WindowUDF { /* private fields */ }
Expand description
Logical representation of a user-defined window function (UDWF) A UDWF is different from a UDF in that it is stateful across batches.
See the documentation on PartitionEvaluator
for more details
-
For simple use cases, use
create_udwf
(examples insimple_udwf.rs
). -
For advanced use cases, use
WindowUDFImpl
which provides full API access (examples inadvanced_udwf.rs
).
§API Note
This is a separate struct from WindowUDFImpl
to maintain backwards
compatibility with the older API.
Implementations§
Source§impl WindowUDF
impl WindowUDF
Sourcepub fn new_from_impl<F>(fun: F) -> WindowUDFwhere
F: WindowUDFImpl + 'static,
pub fn new_from_impl<F>(fun: F) -> WindowUDFwhere
F: WindowUDFImpl + 'static,
Create a new WindowUDF
from a [WindowUDFImpl]
trait object
Note this is the same as using the From
impl (WindowUDF::from
)
Sourcepub fn inner(&self) -> &Arc<dyn WindowUDFImpl>
pub fn inner(&self) -> &Arc<dyn WindowUDFImpl>
Return the underlying WindowUDFImpl
trait object for this function
Sourcepub fn with_aliases(
self,
aliases: impl IntoIterator<Item = &'static str>,
) -> Self
pub fn with_aliases( self, aliases: impl IntoIterator<Item = &'static str>, ) -> Self
Adds additional names that can be used to invoke this function, in
addition to name
If you implement WindowUDFImpl
directly you should return aliases directly.
Sourcepub fn call(&self, args: Vec<Expr>) -> Expr
pub fn call(&self, args: Vec<Expr>) -> Expr
creates a Expr
that calls the window function with default
values for order_by
, partition_by
, window_frame
.
See ExprFunctionExt
for details on setting these values.
This utility allows using a user defined window function without requiring access to the registry, such as with the DataFrame API.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns this function’s name
See WindowUDFImpl::name
for more details.
Sourcepub fn signature(&self) -> &Signature
pub fn signature(&self) -> &Signature
Returns this function’s signature (what input types are accepted)
See WindowUDFImpl::signature
for more details.
Sourcepub fn simplify(&self) -> Option<WindowFunctionSimplification>
pub fn simplify(&self) -> Option<WindowFunctionSimplification>
Do the function rewrite
See WindowUDFImpl::simplify
for more details.
Sourcepub fn expressions(
&self,
expr_args: ExpressionArgs<'_>,
) -> Vec<Arc<dyn PhysicalExpr>>
pub fn expressions( &self, expr_args: ExpressionArgs<'_>, ) -> Vec<Arc<dyn PhysicalExpr>>
Expressions that are passed to the PartitionEvaluator
.
See WindowUDFImpl::expressions
for more details.
Sourcepub fn partition_evaluator_factory(
&self,
partition_evaluator_args: PartitionEvaluatorArgs<'_>,
) -> Result<Box<dyn PartitionEvaluator>>
pub fn partition_evaluator_factory( &self, partition_evaluator_args: PartitionEvaluatorArgs<'_>, ) -> Result<Box<dyn PartitionEvaluator>>
Return a PartitionEvaluator
for evaluating this window function
Sourcepub fn field(&self, field_args: WindowUDFFieldArgs<'_>) -> Result<Field>
pub fn field(&self, field_args: WindowUDFFieldArgs<'_>) -> Result<Field>
Returns the field of the final result of evaluating this window function.
See WindowUDFImpl::field
for more details.
Sourcepub fn sort_options(&self) -> Option<SortOptions>
pub fn sort_options(&self) -> Option<SortOptions>
Returns custom result ordering introduced by this window function which is used to update ordering equivalences.
See WindowUDFImpl::sort_options
for more details.
Sourcepub fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>>
pub fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>>
See WindowUDFImpl::coerce_types
for more details.
Sourcepub fn reverse_expr(&self) -> ReversedUDWF
pub fn reverse_expr(&self) -> ReversedUDWF
Returns the reversed user-defined window function when the order of evaluation is reversed.
See WindowUDFImpl::reverse_expr
for more details.
Sourcepub fn documentation(&self) -> Option<&Documentation>
pub fn documentation(&self) -> Option<&Documentation>
Returns the documentation for this Window UDF.
Documentation can be accessed programmatically as well as generating publicly facing documentation.
Trait Implementations§
Source§impl PartialOrd for WindowUDF
impl PartialOrd for WindowUDF
impl Eq for WindowUDF
Auto Trait Implementations§
impl Freeze for WindowUDF
impl !RefUnwindSafe for WindowUDF
impl Send for WindowUDF
impl Sync for WindowUDF
impl Unpin for WindowUDF
impl !UnwindSafe for WindowUDF
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
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>
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