1515// specific language governing permissions and limitations
1616// under the License.
1717
18+ use datafusion:: logical_expr:: expr:: { AggregateFunctionParams , WindowFunctionParams } ;
1819use datafusion:: logical_expr:: utils:: exprlist_to_fields;
1920use datafusion:: logical_expr:: {
2021 ExprFuncBuilder , ExprFunctionExt , LogicalPlan , WindowFunctionDefinition ,
@@ -172,6 +173,7 @@ impl PyExpr {
172173 Expr :: ScalarSubquery ( value) => {
173174 Ok ( scalar_subquery:: PyScalarSubquery :: from ( value. clone ( ) ) . into_bound_py_any ( py) ?)
174175 }
176+ #[ allow( deprecated) ]
175177 Expr :: Wildcard { qualifier, options } => Err ( py_unsupported_variant_err ( format ! (
176178 "Converting Expr::Wildcard to a Python object is not implemented : {:?} {:?}" ,
177179 qualifier, options
@@ -332,7 +334,6 @@ impl PyExpr {
332334 | Expr :: AggregateFunction { .. }
333335 | Expr :: WindowFunction { .. }
334336 | Expr :: InList { .. }
335- | Expr :: Wildcard { .. }
336337 | Expr :: Exists { .. }
337338 | Expr :: InSubquery { .. }
338339 | Expr :: GroupingSet ( ..)
@@ -346,6 +347,10 @@ impl PyExpr {
346347 | Expr :: Unnest ( _)
347348 | Expr :: IsNotUnknown ( _) => RexType :: Call ,
348349 Expr :: ScalarSubquery ( ..) => RexType :: ScalarSubquery ,
350+ #[ allow( deprecated) ]
351+ Expr :: Wildcard { .. } => {
352+ return Err ( py_unsupported_variant_err ( "Expr::Wildcard is unsupported" ) )
353+ }
349354 } )
350355 }
351356
@@ -394,11 +399,15 @@ impl PyExpr {
394399 | Expr :: InSubquery ( InSubquery { expr, .. } ) => Ok ( vec ! [ PyExpr :: from( * expr. clone( ) ) ] ) ,
395400
396401 // Expr variants containing a collection of Expr(s) for operands
397- Expr :: AggregateFunction ( AggregateFunction { args, .. } )
402+ Expr :: AggregateFunction ( AggregateFunction {
403+ params : AggregateFunctionParams { args, .. } ,
404+ ..
405+ } )
398406 | Expr :: ScalarFunction ( ScalarFunction { args, .. } )
399- | Expr :: WindowFunction ( WindowFunction { args, .. } ) => {
400- Ok ( args. iter ( ) . map ( |arg| PyExpr :: from ( arg. clone ( ) ) ) . collect ( ) )
401- }
407+ | Expr :: WindowFunction ( WindowFunction {
408+ params : WindowFunctionParams { args, .. } ,
409+ ..
410+ } ) => Ok ( args. iter ( ) . map ( |arg| PyExpr :: from ( arg. clone ( ) ) ) . collect ( ) ) ,
402411
403412 // Expr(s) that require more specific processing
404413 Expr :: Case ( Case {
@@ -465,13 +474,17 @@ impl PyExpr {
465474 Expr :: GroupingSet ( ..)
466475 | Expr :: Unnest ( _)
467476 | Expr :: OuterReferenceColumn ( _, _)
468- | Expr :: Wildcard { .. }
469477 | Expr :: ScalarSubquery ( ..)
470478 | Expr :: Placeholder { .. }
471479 | Expr :: Exists { .. } => Err ( py_runtime_err ( format ! (
472480 "Unimplemented Expr type: {}" ,
473481 self . expr
474482 ) ) ) ,
483+
484+ #[ allow( deprecated) ]
485+ Expr :: Wildcard { .. } => {
486+ Err ( py_unsupported_variant_err ( "Expr::Wildcard is unsupported" ) )
487+ }
475488 }
476489 }
477490
@@ -575,7 +588,7 @@ impl PyExpr {
575588 Expr :: AggregateFunction ( agg_fn) => {
576589 let window_fn = Expr :: WindowFunction ( WindowFunction :: new (
577590 WindowFunctionDefinition :: AggregateUDF ( agg_fn. func . clone ( ) ) ,
578- agg_fn. args . clone ( ) ,
591+ agg_fn. params . args . clone ( ) ,
579592 ) ) ;
580593
581594 add_builder_fns_to_window (
@@ -663,16 +676,8 @@ impl PyExpr {
663676
664677 /// Create a [Field] representing an [Expr], given an input [LogicalPlan] to resolve against
665678 pub fn expr_to_field ( expr : & Expr , input_plan : & LogicalPlan ) -> PyDataFusionResult < Arc < Field > > {
666- match expr {
667- Expr :: Wildcard { .. } => {
668- // Since * could be any of the valid column names just return the first one
669- Ok ( Arc :: new ( input_plan. schema ( ) . field ( 0 ) . clone ( ) ) )
670- }
671- _ => {
672- let fields = exprlist_to_fields ( & [ expr. clone ( ) ] , input_plan) ?;
673- Ok ( fields[ 0 ] . 1 . clone ( ) )
674- }
675- }
679+ let fields = exprlist_to_fields ( & [ expr. clone ( ) ] , input_plan) ?;
680+ Ok ( fields[ 0 ] . 1 . clone ( ) )
676681 }
677682 fn _types ( expr : & Expr ) -> PyResult < DataTypeMap > {
678683 match expr {
0 commit comments