@@ -25,7 +25,6 @@ use crate::physical_plan::{
2525 aggregates, expressions:: binary_operator_data_type, functions, udf:: ScalarUDF ,
2626 window_functions,
2727} ;
28- use crate :: utils:: get_field;
2928use crate :: { physical_plan:: udaf:: AggregateUDF , scalar:: ScalarValue } ;
3029use aggregates:: { AccumulatorFunctionImplementation , StateTypeFunction } ;
3130use arrow:: { compute:: can_cast_types, datatypes:: DataType } ;
@@ -245,13 +244,6 @@ pub enum Expr {
245244 IsNull ( Box < Expr > ) ,
246245 /// arithmetic negation of an expression, the operand must be of a signed numeric data type
247246 Negative ( Box < Expr > ) ,
248- /// Returns the field of a [`StructArray`] by name
249- GetField {
250- /// the expression to take the field from
251- expr : Box < Expr > ,
252- /// The name of the field to take
253- name : String ,
254- } ,
255247 /// Whether an expression is between a given range.
256248 Between {
257249 /// The value to compare
@@ -440,10 +432,6 @@ impl Expr {
440432 Expr :: Wildcard => Err ( DataFusionError :: Internal (
441433 "Wildcard expressions are not valid in a logical query plan" . to_owned ( ) ,
442434 ) ) ,
443- Expr :: GetField { ref expr, name } => {
444- let data_type = expr. get_type ( schema) ?;
445- get_field ( & data_type, name) . map ( |x| x. data_type ( ) . clone ( ) )
446- }
447435 }
448436 }
449437
@@ -499,10 +487,6 @@ impl Expr {
499487 Expr :: Wildcard => Err ( DataFusionError :: Internal (
500488 "Wildcard expressions are not valid in a logical query plan" . to_owned ( ) ,
501489 ) ) ,
502- Expr :: GetField { ref expr, name } => {
503- let data_type = expr. get_type ( input_schema) ?;
504- get_field ( & data_type, name) . map ( |x| x. is_nullable ( ) )
505- }
506490 }
507491 }
508492
@@ -643,14 +627,6 @@ impl Expr {
643627 Expr :: IsNotNull ( Box :: new ( self ) )
644628 }
645629
646- /// Returns the values of the field `name` from an expression returning a `Struct`
647- pub fn get_field < I : Into < String > > ( self , name : I ) -> Expr {
648- Expr :: GetField {
649- expr : Box :: new ( self ) ,
650- name : name. into ( ) ,
651- }
652- }
653-
654630 /// Create a sort expression from an existing expression.
655631 ///
656632 /// ```
@@ -786,7 +762,6 @@ impl Expr {
786762 . try_fold ( visitor, |visitor, arg| arg. accept ( visitor) )
787763 }
788764 Expr :: Wildcard => Ok ( visitor) ,
789- Expr :: GetField { ref expr, .. } => expr. accept ( visitor) ,
790765 } ?;
791766
792767 visitor. post_visit ( self )
@@ -944,10 +919,6 @@ impl Expr {
944919 negated,
945920 } ,
946921 Expr :: Wildcard => Expr :: Wildcard ,
947- Expr :: GetField { expr, name } => Expr :: GetField {
948- expr : rewrite_boxed ( expr, rewriter) ?,
949- name,
950- } ,
951922 } ;
952923
953924 // now rewrite this expression itself
@@ -1709,7 +1680,6 @@ impl fmt::Debug for Expr {
17091680 }
17101681 }
17111682 Expr :: Wildcard => write ! ( f, "*" ) ,
1712- Expr :: GetField { ref expr, name } => write ! ( f, "({:?}).{}" , expr, name) ,
17131683 }
17141684 }
17151685}
@@ -1786,10 +1756,6 @@ fn create_name(e: &Expr, input_schema: &DFSchema) -> Result<String> {
17861756 let expr = create_name ( expr, input_schema) ?;
17871757 Ok ( format ! ( "{} IS NOT NULL" , expr) )
17881758 }
1789- Expr :: GetField { expr, name } => {
1790- let expr = create_name ( expr, input_schema) ?;
1791- Ok ( format ! ( "{}.{}" , expr, name) )
1792- }
17931759 Expr :: ScalarFunction { fun, args, .. } => {
17941760 create_function_name ( & fun. to_string ( ) , false , args, input_schema)
17951761 }
@@ -1911,12 +1877,6 @@ mod tests {
19111877 ) ;
19121878 }
19131879
1914- #[ test]
1915- fn display_get_field ( ) {
1916- let col_null = col ( "col1" ) . get_field ( "name" ) ;
1917- assert_eq ! ( format!( "{:?}" , col_null) , "(#col1).name" ) ;
1918- }
1919-
19201880 #[ derive( Default ) ]
19211881 struct RecordingRewriter {
19221882 v : Vec < String > ,
0 commit comments