From e0459322e839d2b62363a78456436f8f8e3884b4 Mon Sep 17 00:00:00 2001 From: jiacai2050 Date: Tue, 26 Dec 2023 17:59:32 +0800 Subject: [PATCH] add blacklist expr fn --- .../src/dist_sql_query/physical_plan.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/df_engine_extensions/src/dist_sql_query/physical_plan.rs b/df_engine_extensions/src/dist_sql_query/physical_plan.rs index 4b1e03930b..9825227c7f 100644 --- a/df_engine_extensions/src/dist_sql_query/physical_plan.rs +++ b/df_engine_extensions/src/dist_sql_query/physical_plan.rs @@ -620,23 +620,20 @@ pub enum PushDownEvent { } impl PushDownEvent { + // Those aggregate functions can't be pushed down. + // https://github.com/apache/incubator-horaedb/issues/1405 + fn blacklist_expr(expr: &dyn Any) -> bool { + expr.is::() || expr.is::() + } + pub fn new(plan: Arc) -> Self { if let Some(aggr) = plan.as_any().downcast_ref::() { - // Those aggregate functions can't be pushed down to `ResolvedPartitionedScan` - // https://github.com/apache/incubator-horaedb/issues/1405 for aggr_expr in aggr.aggr_expr() { - if aggr_expr - .as_any() - .downcast_ref::() - .is_some() - || aggr_expr - .as_any() - .downcast_ref::() - .is_some() - { + if Self::blacklist_expr(aggr_expr.as_any()) { return Self::Unable; } } + if *aggr.mode() == AggregateMode::Partial { Self::Terminated(plan) } else {