berkaysynnada commented on code in PR #12967:
URL: https://github.com/apache/datafusion/pull/12967#discussion_r1806261571
##########
datafusion/core/src/physical_optimizer/join_selection.rs:
##########
@@ -1287,6 +1289,29 @@ mod tests_statistical {
);
}
+ #[tokio::test]
+ async fn test_hash_join_swap_on_joins_with_projections() -> Result<()> {
+ let (big, small) = create_big_and_small();
+ let join = Arc::new(HashJoinExec::try_new(
+ Arc::clone(&big),
+ Arc::clone(&small),
+ vec![(
+ Arc::new(Column::new_with_schema("big_col", &big.schema())?),
+ Arc::new(Column::new_with_schema("small_col",
&small.schema())?),
+ )],
+ None,
+ &JoinType::Inner,
+ Some(vec![1]),
+ PartitionMode::Partitioned,
+ false,
+ )?);
+ let swapped = swap_hash_join(&join.clone(), PartitionMode::Partitioned)
+ .expect("swap_hash_join must support joins with projections");
+ assert_eq!(swapped.schema().fields.len(), 1);
+ assert_eq!(swapped.schema().fields[0].name(), "small_col");
+ Ok(())
+ }
+
Review Comment:
I meant these assertions do not know if a projection is added or not. Isn't
it better to assert a new condition like
`assert!(swapped.as_any().is::<HashJoinExec>());` since
```
assert_eq!(swapped.schema().fields.len(), 1);
assert_eq!(swapped.schema().fields[0].name(), "small_col");
```
those ones can be also satisfied by a `ProjectionExec`. Am I missing smth?
--
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]