@@ -21,23 +21,19 @@ use std::convert::{From, Into};
21
21
use datafusion:: arrow:: datatypes:: DataType ;
22
22
use datafusion:: arrow:: pyarrow:: PyArrowType ;
23
23
use datafusion:: scalar:: ScalarValue ;
24
- use datafusion_common:: DFField ;
25
24
use datafusion_expr:: {
26
25
col,
27
26
expr:: { AggregateFunction , InList , InSubquery , ScalarFunction , Sort , WindowFunction } ,
28
- lit,
29
- utils:: exprlist_to_fields,
30
- Between , BinaryExpr , Case , Cast , Expr , GetFieldAccess , GetIndexedField , Like , LogicalPlan ,
31
- Operator , TryCast ,
27
+ lit, Between , BinaryExpr , Case , Cast , Expr , GetFieldAccess , GetIndexedField , Like , Operator ,
28
+ TryCast ,
32
29
} ;
33
30
34
31
use crate :: common:: data_type:: { DataTypeMap , RexType } ;
35
- use crate :: errors:: { py_datafusion_err, py_runtime_err, py_type_err, DataFusionError } ;
32
+ use crate :: errors:: { py_datafusion_err, py_runtime_err, py_type_err} ;
36
33
use crate :: expr:: aggregate_expr:: PyAggregateFunction ;
37
34
use crate :: expr:: binary_expr:: PyBinaryExpr ;
38
35
use crate :: expr:: column:: PyColumn ;
39
36
use crate :: expr:: literal:: PyLiteral ;
40
- use crate :: sql:: logical:: PyLogicalPlan ;
41
37
42
38
use self :: alias:: PyAlias ;
43
39
use self :: bool_expr:: {
@@ -557,41 +553,9 @@ impl PyExpr {
557
553
}
558
554
} )
559
555
}
560
-
561
- pub fn column_name ( & self , plan : PyLogicalPlan ) -> PyResult < String > {
562
- self . _column_name ( & plan. plan ( ) ) . map_err ( py_runtime_err)
563
- }
564
556
}
565
557
566
558
impl PyExpr {
567
- pub fn _column_name ( & self , plan : & LogicalPlan ) -> Result < String , DataFusionError > {
568
- let field = Self :: expr_to_field ( & self . expr , plan) ?;
569
- Ok ( field. qualified_column ( ) . flat_name ( ) )
570
- }
571
-
572
- /// Create a [DFField] representing an [Expr], given an input [LogicalPlan] to resolve against
573
- pub fn expr_to_field (
574
- expr : & Expr ,
575
- input_plan : & LogicalPlan ,
576
- ) -> Result < DFField , DataFusionError > {
577
- match expr {
578
- Expr :: Sort ( Sort { expr, .. } ) => {
579
- // DataFusion does not support create_name for sort expressions (since they never
580
- // appear in projections) so we just delegate to the contained expression instead
581
- Self :: expr_to_field ( expr, input_plan)
582
- }
583
- Expr :: Wildcard { .. } => {
584
- // Since * could be any of the valid column names just return the first one
585
- Ok ( input_plan. schema ( ) . field ( 0 ) . clone ( ) )
586
- }
587
- _ => {
588
- let fields =
589
- exprlist_to_fields ( & [ expr. clone ( ) ] , input_plan) . map_err ( PyErr :: from) ?;
590
- Ok ( fields[ 0 ] . clone ( ) )
591
- }
592
- }
593
- }
594
-
595
559
fn _types ( expr : & Expr ) -> PyResult < DataTypeMap > {
596
560
match expr {
597
561
Expr :: BinaryExpr ( BinaryExpr {
0 commit comments