@@ -348,6 +348,8 @@ pub enum Expr {
348
348
ListAgg ( ListAgg ) ,
349
349
/// The `ARRAY_AGG` function `SELECT ARRAY_AGG(... ORDER BY ...)`
350
350
ArrayAgg ( ArrayAgg ) ,
351
+ /// The `PERCENTILE_CONT` function `SELECT PERCENTILE_CONT(...) WITHIN GROUP (ORDER BY ...)`
352
+ PercentileCont ( PercentileCont ) ,
351
353
/// The `GROUPING SETS` expr.
352
354
GroupingSets ( Vec < Vec < Expr > > ) ,
353
355
/// The `CUBE` expr.
@@ -549,6 +551,7 @@ impl fmt::Display for Expr {
549
551
Expr :: ArraySubquery ( s) => write ! ( f, "ARRAY({})" , s) ,
550
552
Expr :: ListAgg ( listagg) => write ! ( f, "{}" , listagg) ,
551
553
Expr :: ArrayAgg ( arrayagg) => write ! ( f, "{}" , arrayagg) ,
554
+ Expr :: PercentileCont ( percentilecont) => write ! ( f, "{}" , percentilecont) ,
552
555
Expr :: GroupingSets ( sets) => {
553
556
write ! ( f, "GROUPING SETS (" ) ?;
554
557
let mut sep = "" ;
@@ -2523,6 +2526,25 @@ impl fmt::Display for ArrayAgg {
2523
2526
}
2524
2527
}
2525
2528
2529
+ /// A `PERCENTILE_CONT` invocation `PERCENTILE_CONT( <expr> ) WITHIN GROUP (ORDER BY <sort_expr> )``
2530
+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
2531
+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
2532
+ pub struct PercentileCont {
2533
+ pub expr : Box < Expr > ,
2534
+ pub within_group : Box < OrderByExpr > ,
2535
+ }
2536
+
2537
+ impl fmt:: Display for PercentileCont {
2538
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2539
+ write ! (
2540
+ f,
2541
+ "PERCENTILE_CONT({}) WITHIN GROUP (ORDER BY {})" ,
2542
+ self . expr, self . within_group,
2543
+ ) ?;
2544
+ Ok ( ( ) )
2545
+ }
2546
+ }
2547
+
2526
2548
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
2527
2549
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
2528
2550
pub enum ObjectType {
0 commit comments