@@ -24,6 +24,7 @@ use pyo3::IntoPyObjectExt;
2424use pyo3:: { basic:: CompareOp , prelude:: * } ;
2525use std:: collections:: HashMap ;
2626use std:: convert:: { From , Into } ;
27+ use std:: env:: args;
2728use std:: sync:: Arc ;
2829use window:: PyWindowFrame ;
2930
@@ -150,7 +151,7 @@ impl PyExpr {
150151 Ok ( PyScalarVariable :: new ( data_type, variables) . into_bound_py_any ( py) ?)
151152 }
152153 Expr :: Like ( value) => Ok ( PyLike :: from ( value. clone ( ) ) . into_bound_py_any ( py) ?) ,
153- Expr :: Literal ( value) => Ok ( PyLiteral :: from ( value. clone ( ) ) . into_bound_py_any ( py) ?) ,
154+ Expr :: Literal ( value, metadata ) => Ok ( PyLiteral :: new_with_metadata ( value. clone ( ) , metadata . clone ( ) ) . into_bound_py_any ( py) ?) ,
154155 Expr :: BinaryExpr ( expr) => Ok ( PyBinaryExpr :: from ( expr. clone ( ) ) . into_bound_py_any ( py) ?) ,
155156 Expr :: Not ( expr) => Ok ( PyNot :: new ( * expr. clone ( ) ) . into_bound_py_any ( py) ?) ,
156157 Expr :: IsNotNull ( expr) => Ok ( PyIsNotNull :: new ( * expr. clone ( ) ) . into_bound_py_any ( py) ?) ,
@@ -377,7 +378,7 @@ impl PyExpr {
377378 /// Extracts the Expr value into a PyObject that can be shared with Python
378379 pub fn python_value ( & self , py : Python ) -> PyResult < PyObject > {
379380 match & self . expr {
380- Expr :: Literal ( scalar_value) => scalar_to_pyarrow ( scalar_value, py) ,
381+ Expr :: Literal ( scalar_value, _ ) => scalar_to_pyarrow ( scalar_value, py) ,
381382 _ => Err ( py_type_err ( format ! (
382383 "Non Expr::Literal encountered in types: {:?}" ,
383384 & self . expr
@@ -417,11 +418,13 @@ impl PyExpr {
417418 params : AggregateFunctionParams { args, .. } ,
418419 ..
419420 } )
420- | Expr :: ScalarFunction ( ScalarFunction { args, .. } )
421- | Expr :: WindowFunction ( WindowFunction {
422- params : WindowFunctionParams { args, .. } ,
423- ..
424- } ) => Ok ( args. iter ( ) . map ( |arg| PyExpr :: from ( arg. clone ( ) ) ) . collect ( ) ) ,
421+ | Expr :: ScalarFunction ( ScalarFunction { args, .. } ) => {
422+ Ok ( args. iter ( ) . map ( |arg| PyExpr :: from ( arg. clone ( ) ) ) . collect ( ) )
423+ }
424+ Expr :: WindowFunction ( boxed_window_fn) => {
425+ let args = & boxed_window_fn. params . args ;
426+ Ok ( args. iter ( ) . map ( |arg| PyExpr :: from ( arg. clone ( ) ) ) . collect ( ) )
427+ }
425428
426429 // Expr(s) that require more specific processing
427430 Expr :: Case ( Case {
@@ -600,10 +603,10 @@ impl PyExpr {
600603 ) -> PyDataFusionResult < PyExpr > {
601604 match & self . expr {
602605 Expr :: AggregateFunction ( agg_fn) => {
603- let window_fn = Expr :: WindowFunction ( WindowFunction :: new (
606+ let window_fn = Expr :: WindowFunction ( Box :: new ( WindowFunction :: new (
604607 WindowFunctionDefinition :: AggregateUDF ( agg_fn. func . clone ( ) ) ,
605608 agg_fn. params . args . clone ( ) ,
606- ) ) ;
609+ ) ) ) ;
607610
608611 add_builder_fns_to_window (
609612 window_fn,
@@ -743,7 +746,7 @@ impl PyExpr {
743746 | Operator :: QuestionPipe => Err ( py_type_err ( format ! ( "Unsupported expr: ${op}" ) ) ) ,
744747 } ,
745748 Expr :: Cast ( Cast { expr : _, data_type } ) => DataTypeMap :: map_from_arrow_type ( data_type) ,
746- Expr :: Literal ( scalar_value) => DataTypeMap :: map_from_scalar_value ( scalar_value) ,
749+ Expr :: Literal ( scalar_value, _ ) => DataTypeMap :: map_from_scalar_value ( scalar_value) ,
747750 _ => Err ( py_type_err ( format ! (
748751 "Non Expr::Literal encountered in types: {:?}" ,
749752 expr
0 commit comments