@@ -23,12 +23,12 @@ use std::sync::Arc;
2323
2424use datafusion:: arrow:: datatypes:: { DataType , Field } ;
2525use datafusion:: arrow:: pyarrow:: PyArrowType ;
26+ use datafusion:: functions:: core:: expr_ext:: FieldAccessor ;
2627use datafusion:: scalar:: ScalarValue ;
2728use datafusion_expr:: {
2829 col,
2930 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 ,
3232} ;
3333
3434use crate :: common:: data_type:: { DataTypeMap , RexType } ;
@@ -71,7 +71,6 @@ pub mod filter;
7171pub mod grouping_set;
7272pub mod in_list;
7373pub mod in_subquery;
74- pub mod indexed_field;
7574pub mod join;
7675pub mod like;
7776pub mod limit;
@@ -216,13 +215,7 @@ impl PyExpr {
216215 }
217216
218217 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 ( ) )
226219 }
227220
228221 #[ staticmethod]
@@ -263,7 +256,7 @@ impl PyExpr {
263256 pub fn rex_type ( & self ) -> PyResult < RexType > {
264257 Ok ( match self . expr {
265258 Expr :: Alias ( ..) => RexType :: Alias ,
266- Expr :: Column ( ..) | Expr :: GetIndexedField { .. } => RexType :: Reference ,
259+ Expr :: Column ( ..) => RexType :: Reference ,
267260 Expr :: ScalarVariable ( ..) | Expr :: Literal ( ..) => RexType :: Literal ,
268261 Expr :: BinaryExpr { .. }
269262 | Expr :: Not ( ..)
@@ -417,7 +410,6 @@ impl PyExpr {
417410 | Expr :: IsNotFalse ( expr)
418411 | Expr :: IsNotUnknown ( expr)
419412 | Expr :: Negative ( expr)
420- | Expr :: GetIndexedField ( GetIndexedField { expr, .. } )
421413 | Expr :: Cast ( Cast { expr, .. } )
422414 | Expr :: TryCast ( TryCast { expr, .. } )
423415 | Expr :: Sort ( Sort { expr, .. } )
@@ -674,7 +666,6 @@ pub(crate) fn init_module(m: &PyModule) -> PyResult<()> {
674666 m. add_class :: < cast:: PyCast > ( ) ?;
675667 m. add_class :: < cast:: PyTryCast > ( ) ?;
676668 m. add_class :: < between:: PyBetween > ( ) ?;
677- m. add_class :: < indexed_field:: PyGetIndexedField > ( ) ?;
678669 m. add_class :: < explain:: PyExplain > ( ) ?;
679670 m. add_class :: < limit:: PyLimit > ( ) ?;
680671 m. add_class :: < aggregate:: PyAggregate > ( ) ?;
0 commit comments