Dandandan commented on code in PR #3958:
URL: https://github.com/apache/arrow-datafusion/pull/3958#discussion_r1006145931


##########
datafusion/core/src/physical_plan/joins/hash_join.rs:
##########
@@ -2116,6 +2171,48 @@ mod tests {
         Ok(())
     }
 
+    #[tokio::test]
+    async fn join_right_semi() -> Result<()> {
+        let session_ctx = SessionContext::new();
+        let task_ctx = session_ctx.task_ctx();
+        let left = build_table(
+            ("a2", &vec![10, 20, 30, 40]),
+            ("b1", &vec![4, 5, 6, 5]), // 5 is double on the left
+            ("c2", &vec![70, 80, 90, 100]),
+        );
+        let right = build_table(
+            ("a1", &vec![1, 2, 2, 3]),
+            ("b1", &vec![4, 5, 5, 7]), // 7 does not exist on the left

Review Comment:
   For the right semi join also duplicates on the right must be maintained. So 
I think keeping that makes sense? 
   It is reflected in the output - if it was an equijoin it would have resulted 
in 4 rows...



##########
datafusion/core/src/physical_plan/joins/hash_join.rs:
##########
@@ -2116,6 +2171,48 @@ mod tests {
         Ok(())
     }
 
+    #[tokio::test]
+    async fn join_right_semi() -> Result<()> {
+        let session_ctx = SessionContext::new();
+        let task_ctx = session_ctx.task_ctx();
+        let left = build_table(
+            ("a2", &vec![10, 20, 30, 40]),
+            ("b1", &vec![4, 5, 6, 5]), // 5 is double on the left
+            ("c2", &vec![70, 80, 90, 100]),
+        );
+        let right = build_table(
+            ("a1", &vec![1, 2, 2, 3]),
+            ("b1", &vec![4, 5, 5, 7]), // 7 does not exist on the left

Review Comment:
   For the right semi join also duplicates on the right must be maintained. So 
I think keeping that makes sense? 
   It is reflected in the output - if it was an equijoin it would have resulted 
in 4 rows with b1=5...



-- 
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]

Reply via email to