kylebarron commented on code in PR #6320:
URL: https://github.com/apache/arrow-rs/pull/6320#discussion_r1735180506


##########
arrow/src/pyarrow.rs:
##########
@@ -333,6 +333,15 @@ impl<T: ToPyArrow> ToPyArrow for Vec<T> {
 
 impl FromPyArrow for RecordBatch {
     fn from_pyarrow_bound(value: &Bound<PyAny>) -> PyResult<Self> {
+        // Technically `num_rows` is an attribute on `pyarrow.RecordBatch`
+        // If other python classes can use the PyCapsule interface and do not 
have this attribute,
+        // then this will have no effect.
+        let row_count = value
+            .getattr("num_rows")
+            .ok()
+            .and_then(|x| x.extract().ok());
+        let options = RecordBatchOptions::default().with_row_count(row_count);
+

Review Comment:
   My initial thought is that the PyCapsule interface should handle this, and 
so this should not be before checking for the pycapsule dunder. If this breaks 
via the C data interface, I'd like to look for a fix to that.



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