Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
AggregateExt in datafusion_expr - Rust
[go: Go Back, main page]

Trait datafusion_expr::AggregateExt

source ·
pub trait AggregateExt {
    // Required methods
    fn order_by(self, order_by: Vec<Expr>) -> AggregateBuilder;
    fn filter(self, filter: Expr) -> AggregateBuilder;
    fn distinct(self) -> AggregateBuilder;
    fn null_treatment(self, null_treatment: NullTreatment) -> AggregateBuilder;
}
Expand description

Extensions for configuring Expr::AggregateFunction

Adds methods to Expr that make it easy to set optional aggregate options such as ORDER BY, FILTER and DISTINCT

§Example

use datafusion_expr::AggregateExt;

// Create COUNT(x FILTER y > 5)
let agg = count(col("x"))
   .filter(col("y").gt(lit(5)))
   .build()?;
 // Create FIRST_VALUE(x ORDER BY y IGNORE NULLS)
let sort_expr = col("y").sort(true, true);
let agg = first_value(col("x"))
  .order_by(vec![sort_expr])
  .null_treatment(NullTreatment::IgnoreNulls)
  .build()?;

Required Methods§

source

fn order_by(self, order_by: Vec<Expr>) -> AggregateBuilder

Add ORDER BY <order_by>

Note: order_by must be Expr::Sort

source

fn filter(self, filter: Expr) -> AggregateBuilder

Add FILTER <filter>

source

fn distinct(self) -> AggregateBuilder

Add DISTINCT

source

fn null_treatment(self, null_treatment: NullTreatment) -> AggregateBuilder

Add RESPECT NULLS or IGNORE NULLS

Implementors§