@@ -33,7 +33,7 @@ use datafusion_expr::{
33
33
} ;
34
34
35
35
use crate :: common:: data_type:: { DataTypeMap , RexType } ;
36
- use crate :: errors:: { py_runtime_err, py_type_err, DataFusionError } ;
36
+ use crate :: errors:: { py_runtime_err, py_type_err, py_unsupported_variant_err , DataFusionError } ;
37
37
use crate :: expr:: aggregate_expr:: PyAggregateFunction ;
38
38
use crate :: expr:: binary_expr:: PyBinaryExpr ;
39
39
use crate :: expr:: column:: PyColumn ;
@@ -121,7 +121,8 @@ pub fn py_expr_list(expr: &[Expr]) -> PyResult<Vec<PyExpr>> {
121
121
impl PyExpr {
122
122
/// Return the specific expression
123
123
fn to_variant ( & self , py : Python ) -> PyResult < PyObject > {
124
- Python :: with_gil ( |_| match & self . expr {
124
+ Python :: with_gil ( |_| {
125
+ match & self . expr {
125
126
Expr :: Alias ( alias) => Ok ( PyAlias :: from ( alias. clone ( ) ) . into_py ( py) ) ,
126
127
Expr :: Column ( col) => Ok ( PyColumn :: from ( col. clone ( ) ) . into_py ( py) ) ,
127
128
Expr :: ScalarVariable ( data_type, variables) => {
@@ -149,8 +150,14 @@ impl PyExpr {
149
150
Expr :: Cast ( value) => Ok ( cast:: PyCast :: from ( value. clone ( ) ) . into_py ( py) ) ,
150
151
Expr :: TryCast ( value) => Ok ( cast:: PyTryCast :: from ( value. clone ( ) ) . into_py ( py) ) ,
151
152
Expr :: Sort ( value) => Ok ( sort_expr:: PySortExpr :: from ( value. clone ( ) ) . into_py ( py) ) ,
152
- Expr :: ScalarFunction ( _) => todo ! ( ) ,
153
- Expr :: WindowFunction ( _) => todo ! ( ) ,
153
+ Expr :: ScalarFunction ( value) => Err ( py_unsupported_variant_err ( format ! (
154
+ "Converting Expr::ScalarFunction to a Python object is not implemented: {:?}" ,
155
+ value
156
+ ) ) ) ,
157
+ Expr :: WindowFunction ( value) => Err ( py_unsupported_variant_err ( format ! (
158
+ "Converting Expr::WindowFunction to a Python object is not implemented: {:?}" ,
159
+ value
160
+ ) ) ) ,
154
161
Expr :: InList ( value) => Ok ( in_list:: PyInList :: from ( value. clone ( ) ) . into_py ( py) ) ,
155
162
Expr :: Exists ( value) => Ok ( exists:: PyExists :: from ( value. clone ( ) ) . into_py ( py) ) ,
156
163
Expr :: InSubquery ( value) => {
@@ -159,18 +166,22 @@ impl PyExpr {
159
166
Expr :: ScalarSubquery ( value) => {
160
167
Ok ( scalar_subquery:: PyScalarSubquery :: from ( value. clone ( ) ) . into_py ( py) )
161
168
}
162
- Expr :: Wildcard { qualifier } => {
163
- let _ = qualifier ;
164
- todo ! ( )
165
- }
169
+ Expr :: Wildcard { qualifier } => Err ( py_unsupported_variant_err ( format ! (
170
+ "Converting Expr::Wildcard to a Python object is not implemented : {:?}" ,
171
+ qualifier
172
+ ) ) ) ,
166
173
Expr :: GroupingSet ( value) => {
167
174
Ok ( grouping_set:: PyGroupingSet :: from ( value. clone ( ) ) . into_py ( py) )
168
175
}
169
176
Expr :: Placeholder ( value) => {
170
177
Ok ( placeholder:: PyPlaceholder :: from ( value. clone ( ) ) . into_py ( py) )
171
178
}
172
- Expr :: OuterReferenceColumn ( _, _) => todo ! ( ) ,
179
+ Expr :: OuterReferenceColumn ( data_type, column) => Err ( py_unsupported_variant_err ( format ! (
180
+ "Converting Expr::OuterReferenceColumn to a Python object is not implemented: {:?} - {:?}" ,
181
+ data_type, column
182
+ ) ) ) ,
173
183
Expr :: Unnest ( value) => Ok ( unnest_expr:: PyUnnestExpr :: from ( value. clone ( ) ) . into_py ( py) ) ,
184
+ }
174
185
} )
175
186
}
176
187
0 commit comments