@@ -1118,20 +1118,28 @@ impl Projection {
11181118 pub fn try_new (
11191119 expr : Vec < Expr > ,
11201120 input : Arc < LogicalPlan > ,
1121- alias : Option < String > ,
11221121 ) -> Result < Self , DataFusionError > {
11231122 let schema = Arc :: new ( DFSchema :: new_with_metadata (
11241123 exprlist_to_fields ( & expr, & input) ?,
11251124 input. schema ( ) . metadata ( ) . clone ( ) ,
11261125 ) ?) ;
1127- Self :: try_new_with_schema ( expr, input, schema, alias )
1126+ Self :: try_new_with_schema ( expr, input, schema)
11281127 }
11291128
11301129 /// Create a new Projection using the specified output schema
11311130 pub fn try_new_with_schema (
11321131 expr : Vec < Expr > ,
11331132 input : Arc < LogicalPlan > ,
11341133 schema : DFSchemaRef ,
1134+ ) -> Result < Self , DataFusionError > {
1135+ Self :: try_new_with_schema_alias ( expr, input, schema, None )
1136+ }
1137+
1138+ /// Create a new Projection using the specified output schema
1139+ pub fn try_new_with_schema_alias (
1140+ expr : Vec < Expr > ,
1141+ input : Arc < LogicalPlan > ,
1142+ schema : DFSchemaRef ,
11351143 alias : Option < String > ,
11361144 ) -> Result < Self , DataFusionError > {
11371145 if expr. len ( ) != schema. fields ( ) . len ( ) {
@@ -1146,11 +1154,7 @@ impl Projection {
11461154 }
11471155
11481156 /// Create a new Projection using the specified output schema
1149- pub fn new_from_schema (
1150- input : Arc < LogicalPlan > ,
1151- schema : DFSchemaRef ,
1152- alias : Option < String > ,
1153- ) -> Self {
1157+ pub fn new_from_schema ( input : Arc < LogicalPlan > , schema : DFSchemaRef ) -> Self {
11541158 let expr: Vec < Expr > = schema
11551159 . fields ( )
11561160 . iter ( )
@@ -1161,7 +1165,7 @@ impl Projection {
11611165 expr,
11621166 input,
11631167 schema,
1164- alias,
1168+ alias : None ,
11651169 }
11661170 }
11671171
@@ -1990,7 +1994,6 @@ mod tests {
19901994 schema : empty_schema. clone ( ) ,
19911995 } ) ) ,
19921996 empty_schema,
1993- None ,
19941997 ) ;
19951998 assert_eq ! ( "Error during planning: Projection has mismatch between number of expressions (1) and number of fields in schema (0)" , format!( "{}" , p. err( ) . unwrap( ) ) ) ;
19961999 Ok ( ( ) )
0 commit comments