Skip to content

Commit

Permalink
refactor: PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tshauck committed Jul 17, 2024
1 parent d50c79b commit 542b18f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 97 deletions.
91 changes: 0 additions & 91 deletions datafusion/optimizer/src/analyzer/count_empty_rule.rs

This file was deleted.

4 changes: 2 additions & 2 deletions datafusion/optimizer/src/analyzer/count_wildcard_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ fn is_count_star_aggregate(aggregate_function: &AggregateFunction) -> bool {
func_def: AggregateFunctionDefinition::UDF(udf),
args,
..
} if udf.name() == "count" && args.len() == 1 && is_wildcard(&args[0]))
} if udf.name() == "count" && (args.len() == 1 && is_wildcard(&args[0]) || args.is_empty()))
}

fn is_count_star_window_aggregate(window_function: &WindowFunction) -> bool {
let args = &window_function.args;
matches!(window_function.fun,
WindowFunctionDefinition::AggregateUDF(ref udaf)
if udaf.name() == "count" && args.len() == 1 && is_wildcard(&args[0]))
if udaf.name() == "count" && (args.len() == 1 && is_wildcard(&args[0]) || args.is_empty()))
}

fn analyze_internal(plan: LogicalPlan) -> Result<Transformed<LogicalPlan>> {
Expand Down
3 changes: 0 additions & 3 deletions datafusion/optimizer/src/analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use datafusion_expr::expr::InSubquery;
use datafusion_expr::expr_rewriter::FunctionRewrite;
use datafusion_expr::{Expr, LogicalPlan};

use crate::analyzer::count_empty_rule::CountEmptyRule;
use crate::analyzer::count_wildcard_rule::CountWildcardRule;
use crate::analyzer::inline_table_scan::InlineTableScan;
use crate::analyzer::subquery::check_subquery_expr;
Expand All @@ -38,7 +37,6 @@ use crate::utils::log_plan;

use self::function_rewrite::ApplyFunctionRewrites;

pub mod count_empty_rule;
pub mod count_wildcard_rule;
pub mod function_rewrite;
pub mod inline_table_scan;
Expand Down Expand Up @@ -93,7 +91,6 @@ impl Analyzer {
Arc::new(InlineTableScan::new()),
Arc::new(TypeCoercion::new()),
Arc::new(CountWildcardRule::new()),
Arc::new(CountEmptyRule::new()),
];
Self::with_rules(rules)
}
Expand Down
1 change: 0 additions & 1 deletion datafusion/sqllogictest/test_files/explain.slt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ logical_plan after apply_function_rewrites SAME TEXT AS ABOVE
logical_plan after inline_table_scan SAME TEXT AS ABOVE
logical_plan after type_coercion SAME TEXT AS ABOVE
logical_plan after count_wildcard_rule SAME TEXT AS ABOVE
logical_plan after count_empty_rule SAME TEXT AS ABOVE
analyzed_logical_plan SAME TEXT AS ABOVE
logical_plan after eliminate_nested_union SAME TEXT AS ABOVE
logical_plan after simplify_expressions SAME TEXT AS ABOVE
Expand Down

0 comments on commit 542b18f

Please sign in to comment.