pitrou commented on code in PR #37531:
URL: https://github.com/apache/arrow/pull/37531#discussion_r1315607322
##########
java/c/src/test/python/integration_tests.py:
##########
@@ -195,7 +196,18 @@ def test_list_array(self):
# disabled check_metadata since the list internal field name
("item")
# is not preserved during round trips (it becomes "$data$").
), check_metadata=False)
-
+
+ def test_empty_list_array(self):
Review Comment:
Can you add a comment explaining the motivation for this test, and pointing
to the GH issue number?
##########
java/c/src/test/python/integration_tests.py:
##########
@@ -195,7 +196,18 @@ def test_list_array(self):
# disabled check_metadata since the list internal field name
("item")
# is not preserved during round trips (it becomes "$data$").
), check_metadata=False)
-
+
+ def test_empty_list_array(self):
+ with pa.BufferOutputStream() as bos:
+ schema = pa.schema([pa.field("f0", pa.list_(pa.int32()), True)])
+ with ipc.new_stream(bos, schema) as writer:
+ src = pa.RecordBatch.from_arrays([pa.array([[]])],
schema=schema)
+ writer.write(src)
+ with pa.input_stream(bos.getvalue()) as ios:
+ with ipc.open_stream(ios) as reader:
+ batch = reader.read_next_batch()
+
+ self.round_trip_record_batch(lambda: batch)
Review Comment:
Hmm, the reason the roundtrip methods take a function creating the source
data on the fly, is to properly exercise memory lifetime semantics. So you
should change this to something like:
```suggestion
def recreate_batch():
with pa.input_stream(bos.getvalue()) as ios:
with ipc.open_stream(ios) as reader:
batch = reader.read_next_batch()
self.round_trip_record_batch(recreate_batch)
```
--
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]