You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Jimexist (via GitHub)" <gi...@apache.org> on 2023/04/13 07:28:13 UTC

[GitHub] [arrow-datafusion-python] Jimexist commented on a diff in pull request #324: adding support for join_on to python bindings

Jimexist commented on code in PR #324:
URL: https://github.com/apache/arrow-datafusion-python/pull/324#discussion_r1165115002


##########
src/dataframe.rs:
##########
@@ -212,6 +212,39 @@ impl PyDataFrame {
         Ok(Self::new(df))
     }
 
+    /// Thin wrapper for datafusion-rust `join_on`
+    /// Slightly modified from original `join` above.
+    fn join_on(
+            &self,
+            right: PyDataFrame,
+            on_exprs: Vec<PyExpr>,
+            how: &str,
+        ) -> PyResult<Self> {
+        let join_type = match how {
+            "inner" => JoinType::Inner,
+            "left" => JoinType::Left,
+            "right" => JoinType::Right,
+            "full" => JoinType::Full,
+            "semi" => JoinType::LeftSemi,
+            "anti" => JoinType::LeftAnti,
+            how => {
+                return Err(DataFusionError::Common(format!(
+                    "The join type {how} does not exist or is not implemented"
+                ))
+                .into());
+            }

Review Comment:
   shouldn't this be covered by the https://doc.rust-lang.org/std/str/trait.FromStr.html impl for the enum?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org