You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "simicd (via GitHub)" <gi...@apache.org> on 2023/02/03 23:02:08 UTC

[GitHub] [arrow-datafusion-python] simicd opened a new pull request, #163: feature: Implement count method

simicd opened a new pull request, #163:
URL: https://github.com/apache/arrow-datafusion-python/pull/163

   # Which issue does this PR close?
   Closes #151
   
    # Rationale for this change
   Implement count method in Python bindings after it got introduced in Rust.
   
   # What changes are included in this PR?
   
   
   # Are there any user-facing changes?
   Make `.count()` available


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


[GitHub] [arrow-datafusion-python] andygrove commented on a diff in pull request #163: feature: Implement count method

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #163:
URL: https://github.com/apache/arrow-datafusion-python/pull/163#discussion_r1096541016


##########
src/dataframe.rs:
##########
@@ -302,4 +302,10 @@ impl PyDataFrame {
         wait_for_future(py, self.df.as_ref().clone().write_json(path))?;
         Ok(())
     }
+
+    // Executes this DataFrame to get the total number of rows.
+    fn count(&self, py: Python) -> PyResult<usize> {
+        let count = wait_for_future(py, self.df.as_ref().clone().count());
+        Ok(count.unwrap())

Review Comment:
   The `unwrap` can be avoided here:
   
   ```suggestion
           Ok(wait_for_future(py, self.df.as_ref().clone().count())?)
   ```



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


[GitHub] [arrow-datafusion-python] andygrove merged pull request #163: feature: Implement count method

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #163:
URL: https://github.com/apache/arrow-datafusion-python/pull/163


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


[GitHub] [arrow-datafusion-python] andygrove commented on pull request #163: feature: Implement count method

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #163:
URL: https://github.com/apache/arrow-datafusion-python/pull/163#issuecomment-1416762008

   LGTM once the `unwrap` is removed


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


[GitHub] [arrow-datafusion-python] andygrove commented on a diff in pull request #163: feature: Implement count method

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #163:
URL: https://github.com/apache/arrow-datafusion-python/pull/163#discussion_r1096541016


##########
src/dataframe.rs:
##########
@@ -302,4 +302,10 @@ impl PyDataFrame {
         wait_for_future(py, self.df.as_ref().clone().write_json(path))?;
         Ok(())
     }
+
+    // Executes this DataFrame to get the total number of rows.
+    fn count(&self, py: Python) -> PyResult<usize> {
+        let count = wait_for_future(py, self.df.as_ref().clone().count());
+        Ok(count.unwrap())

Review Comment:
   The `unwrap` can be avoided here:
   
   ```suggestion
           let count = wait_for_future(py, self.df.as_ref().clone().count());
           Ok(count.unwrap())
   ```
   ```suggestion
           Ok(wait_for_future(py, self.df.as_ref().clone().count())?)
   ```



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


[GitHub] [arrow-datafusion-python] simicd commented on pull request #163: feature: Implement count method

Posted by "simicd (via GitHub)" <gi...@apache.org>.
simicd commented on PR #163:
URL: https://github.com/apache/arrow-datafusion-python/pull/163#issuecomment-1416787938

   Many thanks for the feedback @andygrove - removed the unwrap


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