nevi-me commented on a change in pull request #9778:
URL: https://github.com/apache/arrow/pull/9778#discussion_r602801392
##########
File path: rust/arrow/src/ffi.rs
##########
@@ -607,6 +674,10 @@ impl ArrowArray {
.collect()
}
+ pub fn children(&self) -> Result<Vec<ArrayData>> {
Review comment:
nit: may you please add a doc comment here
##########
File path: rust/arrow-pyarrow-integration-testing/tests/test_sql.py
##########
@@ -78,3 +78,23 @@ def test_time32_python(self):
del expected
# No leak of C++ memory
self.assertEqual(old_allocated, pyarrow.total_allocated_bytes())
+
+ def test_list_array(self):
+ """
+ Python -> Rust -> Python
+ """
+ old_allocated = pyarrow.total_allocated_bytes()
+ a = pyarrow.array([[1, 2], [1, 2]], pyarrow.list_(pyarrow.int64()))
+ b = arrow_pyarrow_integration_testing.round_trip(a)
+ # list equality does not work, so we check the elements
Review comment:
@ritchie46 is this a `pyarrow` or Rust limitation?
##########
File path: rust/arrow/src/ffi.rs
##########
@@ -85,10 +85,12 @@ use std::{
sync::Arc,
};
+use crate::array::ArrayData;
use crate::buffer::Buffer;
-use crate::datatypes::{DataType, TimeUnit};
+use crate::datatypes::{DataType, Field, TimeUnit};
use crate::error::{ArrowError, Result};
use crate::util::bit_util;
+use std::convert::TryFrom;
Review comment:
nit: better to group with other `std` imports
##########
File path: rust/arrow/src/ffi.rs
##########
@@ -193,6 +205,20 @@ fn to_datatype(format: &str) -> Result<DataType> {
"ttm" => DataType::Time32(TimeUnit::Millisecond),
"ttu" => DataType::Time64(TimeUnit::Microsecond),
"ttn" => DataType::Time64(TimeUnit::Nanosecond),
+
+ // Note: The datatype null will only be created when called from
ArrowArray::buffer_len
+ // at that point the child data is not yet known, but it is also not
required to determine
+ // the buffer length of the list arrays.
+ "+l" => DataType::List(Box::new(Field::new(
+ "",
Review comment:
There isn't a single expected name for list children, but I'd prefer we
use "item" as that's also used in C++. I think some name is better than an
empty name
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]