HaoYang670 commented on code in PR #4432: URL: https://github.com/apache/arrow-datafusion/pull/4432#discussion_r1036636985
########## datafusion/core/src/physical_plan/joins/cross_join.rs: ########## @@ -61,34 +61,25 @@ pub struct CrossJoinExec { } impl CrossJoinExec { - /// Tries to create a new [CrossJoinExec]. - /// # Error - /// This function errors when left and right schema's can't be combined - pub fn try_new( - left: Arc<dyn ExecutionPlan>, - right: Arc<dyn ExecutionPlan>, - ) -> Result<Self> { - let left_schema = left.schema(); - let right_schema = right.schema(); - check_join_is_valid(&left_schema, &right_schema, &[])?; - - let left_schema = left.schema(); - let left_fields = left_schema.fields().iter(); - let right_schema = right.schema(); - - let right_fields = right_schema.fields().iter(); - + /// Create a new [CrossJoinExec]. + pub fn new(left: Arc<dyn ExecutionPlan>, right: Arc<dyn ExecutionPlan>) -> Self { // left then right - let all_columns = left_fields.chain(right_fields).cloned().collect(); + let all_columns = { + let left_schema = left.schema(); + let right_schema = right.schema(); + let left_fields = left_schema.fields().iter(); + let right_fields = right_schema.fields().iter(); + left_fields.chain(right_fields).cloned().collect() + }; let schema = Arc::new(Schema::new(all_columns)); Review Comment: For the metadata, we should also do concatenation, instead of merging. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org