Struct PlainAggregateWindowExpr
pub struct PlainAggregateWindowExpr {
aggregate: Arc<AggregateFunctionExpr>,
partition_by: Vec<Arc<dyn PhysicalExpr>>,
order_by: Vec<PhysicalSortExpr>,
window_frame: Arc<WindowFrame>,
is_constant_in_partition: bool,
filter: Option<Arc<dyn PhysicalExpr>>,
}Expand description
A window expr that takes the form of an aggregate function.
See comments on WindowExpr for more details.
Fields§
§aggregate: Arc<AggregateFunctionExpr>§partition_by: Vec<Arc<dyn PhysicalExpr>>§order_by: Vec<PhysicalSortExpr>§window_frame: Arc<WindowFrame>§is_constant_in_partition: bool§filter: Option<Arc<dyn PhysicalExpr>>Implementations§
§impl PlainAggregateWindowExpr
impl PlainAggregateWindowExpr
pub fn new(
aggregate: Arc<AggregateFunctionExpr>,
partition_by: &[Arc<dyn PhysicalExpr>],
order_by: &[PhysicalSortExpr],
window_frame: Arc<WindowFrame>,
filter: Option<Arc<dyn PhysicalExpr>>,
) -> PlainAggregateWindowExpr
pub fn new( aggregate: Arc<AggregateFunctionExpr>, partition_by: &[Arc<dyn PhysicalExpr>], order_by: &[PhysicalSortExpr], window_frame: Arc<WindowFrame>, filter: Option<Arc<dyn PhysicalExpr>>, ) -> PlainAggregateWindowExpr
Create a new aggregate window function expression
pub fn get_aggregate_expr(&self) -> &AggregateFunctionExpr
pub fn get_aggregate_expr(&self) -> &AggregateFunctionExpr
Get aggregate expr of AggregateWindowExpr
pub fn add_equal_orderings( &self, eq_properties: &mut EquivalenceProperties, window_expr_index: usize, ) -> Result<(), DataFusionError>
Trait Implementations§
§impl Debug for PlainAggregateWindowExpr
impl Debug for PlainAggregateWindowExpr
§impl WindowExpr for PlainAggregateWindowExpr
peer based evaluation based on the fact that batch is pre-sorted given the sort columns
and then per partition point we’ll evaluate the peer group (e.g. SUM or MAX gives the same
results for peers) and concatenate the results.
impl WindowExpr for PlainAggregateWindowExpr
peer based evaluation based on the fact that batch is pre-sorted given the sort columns and then per partition point we’ll evaluate the peer group (e.g. SUM or MAX gives the same results for peers) and concatenate the results.
§fn field(&self) -> Result<Arc<Field>, DataFusionError>
fn field(&self) -> Result<Arc<Field>, DataFusionError>
The field of the final result of this window function.
§fn name(&self) -> &str
fn name(&self) -> &str
Human readable name such as
"MIN(c2)" or "RANK()". The default
implementation returns placeholder text.§fn expressions(&self) -> Vec<Arc<dyn PhysicalExpr>>
fn expressions(&self) -> Vec<Arc<dyn PhysicalExpr>>
Expressions that are passed to the WindowAccumulator.
Functions which take a single input argument, such as
sum, return a single datafusion_expr::expr::Expr,
others (e.g. cov) return many.§fn evaluate(
&self,
batch: &RecordBatch,
) -> Result<Arc<dyn Array>, DataFusionError>
fn evaluate( &self, batch: &RecordBatch, ) -> Result<Arc<dyn Array>, DataFusionError>
Evaluate the window function values against the batch
§fn evaluate_stateful(
&self,
partition_batches: &IndexMap<Vec<ScalarValue>, PartitionBatchState>,
window_agg_state: &mut IndexMap<Vec<ScalarValue>, WindowState>,
) -> Result<(), DataFusionError>
fn evaluate_stateful( &self, partition_batches: &IndexMap<Vec<ScalarValue>, PartitionBatchState>, window_agg_state: &mut IndexMap<Vec<ScalarValue>, WindowState>, ) -> Result<(), DataFusionError>
Evaluate the window function against the batch. This function facilitates
stateful, bounded-memory implementations.
§fn partition_by(&self) -> &[Arc<dyn PhysicalExpr>]
fn partition_by(&self) -> &[Arc<dyn PhysicalExpr>]
Expressions that’s from the window function’s partition by clause, empty if absent
§fn order_by(&self) -> &[PhysicalSortExpr]
fn order_by(&self) -> &[PhysicalSortExpr]
Expressions that’s from the window function’s order by clause, empty if absent
§fn get_window_frame(&self) -> &Arc<WindowFrame>
fn get_window_frame(&self) -> &Arc<WindowFrame>
Get the window frame of this WindowExpr.
§fn get_reverse_expr(&self) -> Option<Arc<dyn WindowExpr>>
fn get_reverse_expr(&self) -> Option<Arc<dyn WindowExpr>>
Get the reverse expression of this WindowExpr.
§fn uses_bounded_memory(&self) -> bool
fn uses_bounded_memory(&self) -> bool
Return a flag indicating whether this WindowExpr can run with
bounded memory.
§fn create_window_fn(&self) -> Result<WindowFn, DataFusionError>
fn create_window_fn(&self) -> Result<WindowFn, DataFusionError>
Creates a new instance of the window function evaluator. Read more
§fn evaluate_args(
&self,
batch: &RecordBatch,
) -> Result<Vec<Arc<dyn Array>>, DataFusionError>
fn evaluate_args( &self, batch: &RecordBatch, ) -> Result<Vec<Arc<dyn Array>>, DataFusionError>
Evaluate the window function arguments against the batch and return
array ref, normally the resulting
Vec is a single element one.§fn order_by_columns(
&self,
batch: &RecordBatch,
) -> Result<Vec<SortColumn>, DataFusionError>
fn order_by_columns( &self, batch: &RecordBatch, ) -> Result<Vec<SortColumn>, DataFusionError>
Get order by columns, empty if absent
§fn all_expressions(&self) -> WindowPhysicalExpressions
fn all_expressions(&self) -> WindowPhysicalExpressions
Returns all expressions used in the
WindowExpr.
These expressions are (1) function arguments, (2) partition by expressions, (3) order by expressions.§fn with_new_expressions(
&self,
_args: Vec<Arc<dyn PhysicalExpr>>,
_partition_bys: Vec<Arc<dyn PhysicalExpr>>,
_order_by_exprs: Vec<Arc<dyn PhysicalExpr>>,
) -> Option<Arc<dyn WindowExpr>>
fn with_new_expressions( &self, _args: Vec<Arc<dyn PhysicalExpr>>, _partition_bys: Vec<Arc<dyn PhysicalExpr>>, _order_by_exprs: Vec<Arc<dyn PhysicalExpr>>, ) -> Option<Arc<dyn WindowExpr>>
Rewrites
WindowExpr, with new expressions given. The argument should be consistent
with the return value of the WindowExpr::all_expressions method.
Returns Some(Arc<dyn WindowExpr>) if re-write is supported, otherwise returns None.Auto Trait Implementations§
impl Freeze for PlainAggregateWindowExpr
impl !RefUnwindSafe for PlainAggregateWindowExpr
impl Send for PlainAggregateWindowExpr
impl Sync for PlainAggregateWindowExpr
impl Unpin for PlainAggregateWindowExpr
impl !UnwindSafe for PlainAggregateWindowExpr
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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