2010YOUY01 commented on code in PR #23759:
URL: https://github.com/apache/datafusion/pull/23759#discussion_r3642387124
##########
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:
This is a internal API from optimizer, it requires strict pre-conditions in
order to use it correctly, so I think this should not be called directly.
Probably we could either
- mark raw `swap_inputs()` API as unsafe to use directly
- Add sanity checks inside to ensure it must be used correctly
- Deprecate it from the public API
I'm wondering is it possible to trigger the bug from only SQL script 🤔 ? If
yes this seem like a major bug.
--
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]