kylebarron commented on code in PR #6320:
URL: https://github.com/apache/arrow-rs/pull/6320#discussion_r1735208965
##########
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:
I'd strongly prefer a non-pyarrow-specific solution to this, or else we'll
get the same failure from other Arrow producers.
In https://github.com/kylebarron/arro3/pull/177 I added some tests to arro3
to make sure my (arrow-rs derived) FFI can handle this. It's a bit annoying:
the `ArrayData` will have positive length but then once you import that with
`makeData`, you'll have a `StructArray` with length `0`. I _think_ your most
recent commit fixes this.
--
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]