@@ -186,32 +186,8 @@ impl CrossJoinExec {
186186 /// operators on the join's children. Check [`super::HashJoinExec::swap_inputs`]
187187 /// for more details.
188188 pub fn swap_inputs ( & self ) -> Result < Arc < dyn ExecutionPlan > > {
189- // Rebuild schema with columns from right to left, preserve existing metadata
190- let new_columns = self
191- . right
192- . schema ( )
193- . fields
194- . iter ( )
195- . chain ( self . left . schema ( ) . fields . iter ( ) )
196- . cloned ( )
197- . collect :: < Fields > ( ) ;
198-
199- let new_schema = Arc :: new (
200- Schema :: new ( new_columns) . with_metadata ( self . schema . metadata . clone ( ) ) ,
201- ) ;
202-
203- let new_cache =
204- Self :: compute_properties ( & self . right , & self . left , Arc :: clone ( & new_schema) ) ?;
205-
206- let new_join = CrossJoinExec {
207- left : Arc :: clone ( & self . right ) ,
208- right : Arc :: clone ( & self . left ) ,
209- schema : new_schema,
210- left_fut : Default :: default ( ) ,
211- metrics : ExecutionPlanMetricsSet :: default ( ) ,
212- cache : Arc :: new ( new_cache) ,
213- } ;
214-
189+ let new_join =
190+ CrossJoinExec :: new ( Arc :: clone ( & self . right ) , Arc :: clone ( & self . left ) ) ;
215191 reorder_output_after_swap (
216192 Arc :: new ( new_join) ,
217193 & self . left . schema ( ) ,
@@ -775,9 +751,7 @@ impl<T: BatchTransformer> CrossJoinStream<T> {
775751mod tests {
776752 use super :: * ;
777753 use crate :: common;
778- use crate :: test:: { TestMemoryExec , assert_join_metrics, build_table_scan_i32} ;
779- use arrow_schema:: { DataType , Field } ;
780- use std:: collections:: HashMap ;
754+ use crate :: test:: { assert_join_metrics, build_table_scan_i32} ;
781755
782756 use datafusion_common:: { assert_contains, test_util:: batches_to_sort_string} ;
783757 use datafusion_execution:: runtime_env:: RuntimeEnvBuilder ;
@@ -1070,28 +1044,6 @@ mod tests {
10701044 Ok ( ( ) )
10711045 }
10721046
1073- #[ test]
1074- fn test_swapped_cross_join_schema_on_conflicting_metadata ( ) {
1075- let input = |field : & str , meta_value : & str | {
1076- let schema = Arc :: new (
1077- Schema :: new ( vec ! [ Field :: new( field, DataType :: Int32 , false ) ] )
1078- . with_metadata ( HashMap :: from ( [ (
1079- String :: from ( "metadata_key" ) ,
1080- String :: from ( meta_value) ,
1081- ) ] ) ) ,
1082- ) ;
1083- TestMemoryExec :: try_new_exec ( & [ vec ! [ ] ] , schema, None ) . unwrap ( )
1084- } ;
1085- // Conflicting metadata on left and right input, right side wins "metadata_key" -> "right value"
1086- let join =
1087- CrossJoinExec :: new ( input ( "a" , "left value" ) , input ( "b" , "right value" ) ) ;
1088-
1089- let swapped_join = join. swap_inputs ( ) . unwrap ( ) ;
1090-
1091- // The metadata of the cross-join and the swapped cross-join (with projection on top) must be the same
1092- assert_eq ! ( join. schema( ) . metadata( ) , swapped_join. schema( ) . metadata( ) ) ;
1093- }
1094-
10951047 /// Returns the column names on the schema
10961048 fn columns ( schema : & Schema ) -> Vec < String > {
10971049 schema. fields ( ) . iter ( ) . map ( |f| f. name ( ) . clone ( ) ) . collect ( )
0 commit comments