Struct datafusion::logical_expr::WindowUDF
source · 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 documetnation on PartitionEvaluator for more details
-
For simple (less performant) use cases, use
create_udwfandsimple_udwf.rs. -
For advanced use cases, use
WindowUDFImplandadvanced_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(
name: &str,
signature: &Signature,
return_type: &Arc<dyn Fn(&[DataType]) -> Result<Arc<DataType>, DataFusionError> + Send + Sync>,
partition_evaluator_factory: &Arc<dyn Fn() -> Result<Box<dyn PartitionEvaluator>, DataFusionError> + Send + Sync>
) -> WindowUDF
👎Deprecated since 34.0.0: please implement ScalarUDFImpl instead
pub fn new( name: &str, signature: &Signature, return_type: &Arc<dyn Fn(&[DataType]) -> Result<Arc<DataType>, DataFusionError> + Send + Sync>, partition_evaluator_factory: &Arc<dyn Fn() -> Result<Box<dyn PartitionEvaluator>, DataFusionError> + Send + Sync> ) -> WindowUDF
Create a new WindowUDF from low level details.
See WindowUDFImpl for a more convenient way to create a
WindowUDF using trait objects
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 call(
&self,
args: Vec<Expr>,
partition_by: Vec<Expr>,
order_by: Vec<Expr>,
window_frame: WindowFrame
) -> Expr
pub fn call( &self, args: Vec<Expr>, partition_by: Vec<Expr>, order_by: Vec<Expr>, window_frame: WindowFrame ) -> Expr
creates a Expr that calls the window function given
the partition_by, order_by, and window_frame definition
This utility allows using the UDWF 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 return_type(
&self,
args: &[DataType]
) -> Result<DataType, DataFusionError>
pub fn return_type( &self, args: &[DataType] ) -> Result<DataType, DataFusionError>
Return the type of the function given its input types
See WindowUDFImpl::return_type for more details.
sourcepub fn partition_evaluator_factory(
&self
) -> Result<Box<dyn PartitionEvaluator>, DataFusionError>
pub fn partition_evaluator_factory( &self ) -> Result<Box<dyn PartitionEvaluator>, DataFusionError>
Return a PartitionEvaluator for evaluating this window function
Trait Implementations§
source§impl PartialEq for WindowUDF
impl PartialEq for WindowUDF
impl Eq for WindowUDF
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.