@@ -11,8 +11,9 @@ use datafusion::{
1111 execution:: { context:: SessionState , TaskContext } ,
1212 logical_expr:: {
1313 expr:: {
14- AggregateFunction , Alias , Exists , InList , InSubquery , PlannedReplaceSelectItem ,
15- ScalarFunction , Sort , Unnest , WildcardOptions , WindowFunction ,
14+ AggregateFunction , AggregateFunctionParams , Alias , Exists , InList , InSubquery ,
15+ PlannedReplaceSelectItem , ScalarFunction , Sort , Unnest , WildcardOptions ,
16+ WindowFunction , WindowFunctionParams ,
1617 } ,
1718 Between , BinaryExpr , Case , Cast , Expr , Extension , GroupingSet , Like , Limit , LogicalPlan ,
1819 Subquery , TryCast ,
@@ -463,16 +464,19 @@ fn rewrite_table_scans_in_expr(
463464 }
464465 Expr :: AggregateFunction ( af) => {
465466 let args = af
467+ . params
466468 . args
467469 . into_iter ( )
468470 . map ( |e| rewrite_table_scans_in_expr ( e, known_rewrites) )
469471 . collect :: < Result < Vec < Expr > > > ( ) ?;
470472 let filter = af
473+ . params
471474 . filter
472475 . map ( |e| rewrite_table_scans_in_expr ( * e, known_rewrites) )
473476 . transpose ( ) ?
474477 . map ( Box :: new) ;
475478 let order_by = af
479+ . params
476480 . order_by
477481 . map ( |e| {
478482 e. into_iter ( )
@@ -485,27 +489,33 @@ fn rewrite_table_scans_in_expr(
485489 . collect :: < Result < Vec < _ > > > ( )
486490 } )
487491 . transpose ( ) ?;
488- Ok ( Expr :: AggregateFunction ( AggregateFunction {
489- func : af. func ,
492+ let params = AggregateFunctionParams {
490493 args,
491- distinct : af. distinct ,
494+ distinct : af. params . distinct ,
492495 filter,
493496 order_by,
494- null_treatment : af. null_treatment ,
497+ null_treatment : af. params . null_treatment ,
498+ } ;
499+ Ok ( Expr :: AggregateFunction ( AggregateFunction {
500+ func : af. func ,
501+ params,
495502 } ) )
496503 }
497504 Expr :: WindowFunction ( wf) => {
498505 let args = wf
506+ . params
499507 . args
500508 . into_iter ( )
501509 . map ( |e| rewrite_table_scans_in_expr ( e, known_rewrites) )
502510 . collect :: < Result < Vec < Expr > > > ( ) ?;
503511 let partition_by = wf
512+ . params
504513 . partition_by
505514 . into_iter ( )
506515 . map ( |e| rewrite_table_scans_in_expr ( e, known_rewrites) )
507516 . collect :: < Result < Vec < Expr > > > ( ) ?;
508517 let order_by = wf
518+ . params
509519 . order_by
510520 . into_iter ( )
511521 . map ( |sort| {
@@ -515,13 +525,16 @@ fn rewrite_table_scans_in_expr(
515525 } )
516526 } )
517527 . collect :: < Result < Vec < _ > > > ( ) ?;
518- Ok ( Expr :: WindowFunction ( WindowFunction {
519- fun : wf. fun ,
528+ let params = WindowFunctionParams {
520529 args,
521530 partition_by,
522531 order_by,
523- window_frame : wf. window_frame ,
524- null_treatment : wf. null_treatment ,
532+ window_frame : wf. params . window_frame ,
533+ null_treatment : wf. params . null_treatment ,
534+ } ;
535+ Ok ( Expr :: WindowFunction ( WindowFunction {
536+ fun : wf. fun ,
537+ params,
525538 } ) )
526539 }
527540 Expr :: InList ( il) => {
@@ -566,6 +579,8 @@ fn rewrite_table_scans_in_expr(
566579 is. negated ,
567580 ) ) )
568581 }
582+ // TODO: remove the next line after `Expr::Wildcard` is removed in datafusion
583+ #[ expect( deprecated) ]
569584 Expr :: Wildcard { qualifier, options } => {
570585 let options = WildcardOptions {
571586 replace : options
@@ -777,8 +792,7 @@ mod tests {
777792 use crate :: FederatedTableProviderAdaptor ;
778793 use datafusion:: {
779794 arrow:: datatypes:: { DataType , Field } ,
780- catalog:: SchemaProvider ,
781- catalog_common:: MemorySchemaProvider ,
795+ catalog:: { MemorySchemaProvider , SchemaProvider } ,
782796 common:: Column ,
783797 datasource:: { DefaultTableSource , TableProvider } ,
784798 error:: DataFusionError ,
0 commit comments