@@ -23,12 +23,12 @@ use std::sync::Arc;
23
23
24
24
use datafusion:: arrow:: datatypes:: { DataType , Field } ;
25
25
use datafusion:: arrow:: pyarrow:: PyArrowType ;
26
+ use datafusion:: functions:: core:: expr_ext:: FieldAccessor ;
26
27
use datafusion:: scalar:: ScalarValue ;
27
28
use datafusion_expr:: {
28
29
col,
29
30
expr:: { AggregateFunction , InList , InSubquery , ScalarFunction , Sort , WindowFunction } ,
30
- lit, Between , BinaryExpr , Case , Cast , Expr , GetFieldAccess , GetIndexedField , Like , Operator ,
31
- TryCast ,
31
+ lit, Between , BinaryExpr , Case , Cast , Expr , GetFieldAccess , Like , Operator , TryCast ,
32
32
} ;
33
33
34
34
use crate :: common:: data_type:: { DataTypeMap , RexType } ;
@@ -71,7 +71,6 @@ pub mod filter;
71
71
pub mod grouping_set;
72
72
pub mod in_list;
73
73
pub mod in_subquery;
74
- pub mod indexed_field;
75
74
pub mod join;
76
75
pub mod like;
77
76
pub mod limit;
@@ -216,13 +215,7 @@ impl PyExpr {
216
215
}
217
216
218
217
fn __getitem__ ( & self , key : & str ) -> PyResult < PyExpr > {
219
- Ok ( Expr :: GetIndexedField ( GetIndexedField :: new (
220
- Box :: new ( self . expr . clone ( ) ) ,
221
- GetFieldAccess :: NamedStructField {
222
- name : ScalarValue :: Utf8 ( Some ( key. to_string ( ) ) ) ,
223
- } ,
224
- ) )
225
- . into ( ) )
218
+ Ok ( self . expr . clone ( ) . field ( key) . into ( ) )
226
219
}
227
220
228
221
#[ staticmethod]
@@ -263,7 +256,7 @@ impl PyExpr {
263
256
pub fn rex_type ( & self ) -> PyResult < RexType > {
264
257
Ok ( match self . expr {
265
258
Expr :: Alias ( ..) => RexType :: Alias ,
266
- Expr :: Column ( ..) | Expr :: GetIndexedField { .. } => RexType :: Reference ,
259
+ Expr :: Column ( ..) => RexType :: Reference ,
267
260
Expr :: ScalarVariable ( ..) | Expr :: Literal ( ..) => RexType :: Literal ,
268
261
Expr :: BinaryExpr { .. }
269
262
| Expr :: Not ( ..)
@@ -417,7 +410,6 @@ impl PyExpr {
417
410
| Expr :: IsNotFalse ( expr)
418
411
| Expr :: IsNotUnknown ( expr)
419
412
| Expr :: Negative ( expr)
420
- | Expr :: GetIndexedField ( GetIndexedField { expr, .. } )
421
413
| Expr :: Cast ( Cast { expr, .. } )
422
414
| Expr :: TryCast ( TryCast { expr, .. } )
423
415
| Expr :: Sort ( Sort { expr, .. } )
@@ -674,7 +666,6 @@ pub(crate) fn init_module(m: &PyModule) -> PyResult<()> {
674
666
m. add_class :: < cast:: PyCast > ( ) ?;
675
667
m. add_class :: < cast:: PyTryCast > ( ) ?;
676
668
m. add_class :: < between:: PyBetween > ( ) ?;
677
- m. add_class :: < indexed_field:: PyGetIndexedField > ( ) ?;
678
669
m. add_class :: < explain:: PyExplain > ( ) ?;
679
670
m. add_class :: < limit:: PyLimit > ( ) ?;
680
671
m. add_class :: < aggregate:: PyAggregate > ( ) ?;
0 commit comments