Trait polars_lazy::physical_plan::expressions::PhysicalExpr [−][src]
pub trait PhysicalExpr: Send + Sync { fn evaluate(
&self,
df: &DataFrame,
_state: &ExecutionState
) -> Result<Series>; fn to_field(&self, input_schema: &Schema) -> Result<Field>; fn as_expression(&self) -> &Expr { ... } fn evaluate_on_groups<'a>(
&self,
df: &DataFrame,
groups: &'a GroupTuples,
state: &ExecutionState
) -> Result<(Series, Cow<'a, GroupTuples>)> { ... } fn as_agg_expr(&self) -> Result<&dyn PhysicalAggregation> { ... } }
Expand description
Take a DataFrame and evaluate the expressions. Implement this for Column, lt, eq, etc
Required methods
Take a DataFrame and evaluate the expression.
Provided methods
fn as_expression(&self) -> &Expr
[src]fn evaluate_on_groups<'a>(
&self,
df: &DataFrame,
groups: &'a GroupTuples,
state: &ExecutionState
) -> Result<(Series, Cow<'a, GroupTuples>)>
[src]
fn evaluate_on_groups<'a>(
&self,
df: &DataFrame,
groups: &'a GroupTuples,
state: &ExecutionState
) -> Result<(Series, Cow<'a, GroupTuples>)>
[src]Some expression that are not aggregations can be done per group Think of sort, slice, filter, etc. defaults to ignoring the group
This method is called by an aggregation function.
In case of a simple expr, like ‘column’, the groups are ignored and the column is returned. In case of an expr where group behavior makes sense, this method is called. For a filter operation for instance, a Series is created per groups and filtered.
This has some gotcha’s. An implementation may also change the group tuples instead of
the Series
.
fn as_agg_expr(&self) -> Result<&dyn PhysicalAggregation>
[src]
fn as_agg_expr(&self) -> Result<&dyn PhysicalAggregation>
[src]Convert to a aggregation expression. This can only be done for the final expressions that produce an aggregated result.
The expression sum, min, max etc can be called as evaluate
in the standard context,
or during a groupby execution, this method is called to convert them to an AggPhysicalExpr