xudong963 commented on a change in pull request #1258:
URL: https://github.com/apache/arrow-datafusion/pull/1258#discussion_r744676095



##########
File path: datafusion/src/execution/dataframe_impl.rs
##########
@@ -231,6 +231,29 @@ impl DataFrame for DataFrameImpl {
                 .build()?,
         )))
     }
+
+    fn intersect(&self, dataframe: Arc<dyn DataFrame>) -> Result<Arc<dyn 
DataFrame>> {
+        let left_plan = self.to_logical_plan();
+        let right_plan = dataframe.to_logical_plan();
+        let join_keys = left_plan
+            .schema()
+            .fields()
+            .iter()
+            .zip(right_plan.schema().fields().iter())
+            .map(|(left_field, right_field)| {
+                (
+                    (Column::from_name(left_field.name())),
+                    (Column::from_name(right_field.name())),
+                )
+            })
+            .unzip();
+        Ok(Arc::new(DataFrameImpl::new(
+            self.ctx_state.clone(),
+            &LogicalPlanBuilder::from(left_plan)
+                .join_detailed(&right_plan, JoinType::Semi, join_keys, true)?
+                .build()?,

Review comment:
       yes!




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