alamb commented on code in PR #23759:
URL: https://github.com/apache/datafusion/pull/23759#discussion_r3647483251


##########
datafusion/core/tests/sql/joins.rs:
##########
@@ -299,3 +302,35 @@ async fn unparse_cross_join() -> Result<()> {
 
     Ok(())
 }
+
+#[test]
+fn test_swap_joins_on_conflicting_metadata() {
+    let input = |field: &str, meta_value: &str| {
+        let schema = Arc::new(
+            Schema::new(vec![Field::new(field, DataType::Int32, 
false)]).with_metadata(
+                HashMap::from([(String::from("metadata_key"), 
String::from(meta_value))]),
+            ),
+        );
+        TestMemoryExec::try_new_exec(&[vec![]], schema, None).unwrap()
+    };
+
+    let join = CrossJoinExec::new(input("a", "left value"), input("b", "right 
value"));
+
+    let swapped_join = join.swap_inputs().unwrap();

Review Comment:
   If swap_inputs is not safe we should definitely mark it thusly
   
   There are some caveats documented here
   - 
https://docs.rs/datafusion/latest/datafusion/physical_plan/joins/struct.HashJoinExec.html#method.swap_inputs
   
   > This function is public so other downstream projects can use it to 
construct HashJoinExec with right side as the build side.
   
   I do think it is meant to be used publically and the usecase is reasonable 
in my mind (user control over join order)
   
   If it is hard to use / easy to mess up, perhaps we can find a better API



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to