Skip to content

Commit a1684f9

Browse files
committed
fix
1 parent 2bfcd6e commit a1684f9

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

datafusion/optimizer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ chrono = { workspace = true }
4646
datafusion-common = { workspace = true, default-features = true }
4747
datafusion-expr = { workspace = true }
4848
datafusion-expr-common = { workspace = true }
49+
datafusion-functions-aggregate = { workspace = true }
4950
datafusion-physical-expr = { workspace = true }
5051
indexmap = { workspace = true }
5152
itertools = { workspace = true }
@@ -58,7 +59,6 @@ regex-syntax = "0.8.6"
5859
async-trait = { workspace = true }
5960
criterion = { workspace = true }
6061
ctor = { workspace = true }
61-
datafusion-functions-aggregate = { workspace = true }
6262
datafusion-functions-window = { workspace = true }
6363
datafusion-functions-window-common = { workspace = true }
6464
datafusion-sql = { workspace = true }

datafusion/optimizer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ pub mod replace_distinct_aggregate;
6262
pub mod scalar_subquery_to_join;
6363
pub mod simplify_expressions;
6464
pub mod single_distinct_to_groupby;
65+
pub mod rewrite_limit_to_aggregate;
6566
pub mod utils;
6667

6768
#[cfg(test)]
@@ -74,7 +75,6 @@ pub use optimizer::{
7475

7576
pub(crate) mod join_key_set;
7677
mod plan_signature;
77-
mod RewriteLimitToAggregate;
7878

7979
#[cfg(test)]
8080
#[ctor::ctor]

datafusion/optimizer/src/optimizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use crate::propagate_empty_relation::PropagateEmptyRelation;
5252
use crate::push_down_filter::PushDownFilter;
5353
use crate::push_down_limit::PushDownLimit;
5454
use crate::replace_distinct_aggregate::ReplaceDistinctWithAggregate;
55-
use crate::RewriteLimitToAggregate::RewriteLimitToAggregate;
55+
use crate::rewrite_limit_to_aggregate::RewriteLimitToAggregate;
5656
use crate::scalar_subquery_to_join::ScalarSubqueryToJoin;
5757
use crate::simplify_expressions::SimplifyExpressions;
5858
use crate::single_distinct_to_groupby::SingleDistinctToGroupBy;

datafusion/optimizer/src/RewriteLimitToAggregate.rs renamed to datafusion/optimizer/src/rewrite_limit_to_aggregate.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
3232
use std::sync::Arc;
3333

34-
use datafusion_common::tree_node::{Transformed, TreeNode};
34+
use datafusion_common::tree_node::Transformed;
3535
use datafusion_common::{Result, Column};
36-
use datafusion_expr::{Expr, LogicalPlan, Sort, Limit, Aggregate, logical_plan::builder::LogicalPlanBuilder, FetchType, SkipType, AggregateUDF};
36+
use datafusion_expr::{Expr, LogicalPlan, Sort, Limit, logical_plan::builder::LogicalPlanBuilder, FetchType, SkipType, AggregateUDF};
3737
use datafusion_expr::expr::AggregateFunctionParams;
3838
use datafusion_functions_aggregate::min_max::{Max, Min};
3939
use crate::{OptimizerConfig, OptimizerRule, ApplyOrder};
@@ -149,7 +149,7 @@ impl RewriteLimitToAggregate {
149149
///
150150
/// Returns Some(RewriteInfo) if the sort expression is a simple column reference,
151151
/// or None if it's a complex expression
152-
fn extract_rewrite_info(&self, sort: &Sort, limit: &Limit) -> Option<RewriteInfo> {
152+
fn extract_rewrite_info(&self, sort: &Sort) -> Option<RewriteInfo> {
153153
let sort_expr = &sort.expr[0];
154154

155155
// The sort expression must be a simple column reference, not a complex expression
@@ -215,7 +215,7 @@ impl OptimizerRule for RewriteLimitToAggregate {
215215
};
216216

217217
// Try to extract rewrite information from the sort expression
218-
if let Some(info) = self.extract_rewrite_info(sort, &limit) {
218+
if let Some(info) = self.extract_rewrite_info(sort) {
219219
// Pattern matched successfully - perform the rewrite
220220
let new_plan = self.rewrite_to_aggregate(info)?;
221221
Ok(Transformed::yes(new_plan))
@@ -229,7 +229,7 @@ impl OptimizerRule for RewriteLimitToAggregate {
229229
#[cfg(test)]
230230
mod tests {
231231
use super::*;
232-
use datafusion_expr::{col, lit, logical_plan::table_scan, UserDefinedLogicalNode};
232+
use datafusion_expr::{col, lit, logical_plan::table_scan};
233233
use arrow::datatypes::{DataType, Field, Schema};
234234

235235
/// Helper function to create a test table with standard columns

0 commit comments

Comments
 (0)