AlenkaF commented on code in PR #38520:
URL: https://github.com/apache/arrow/pull/38520#discussion_r1391182668
##########
python/pyarrow/tests/test_table.py:
##########
@@ -878,6 +878,55 @@ def test_recordbatch_from_struct_array():
))
+def test_recordbatch_to_struct_array():
+ batch = pa.RecordBatch.from_arrays(
+ [
+ pa.array([1, None], type=pa.int32()),
+ pa.array([None, 1.0], type=pa.float32()),
+ ], ["ints", "floats"]
+ )
+ result = batch.to_struct_array()
+ assert result.equals(pa.array(
+ [{"ints": 1}, {"floats": 1.0}],
+ type=pa.struct([("ints", pa.int32()), ("floats", pa.float32())]),
+ ))
+
+
+def test_table_from_struct_array_invalid():
+ with pytest.raises(TypeError):
Review Comment:
Just a nit: could we add a message check here also? It helps reviewing and
also later when looking at the tests, like here:
https://github.com/apache/arrow/blob/79c72a67f90719fb1af315a9b2b8caa25d667775/python/pyarrow/tests/test_table.py#L800-L802
##########
python/pyarrow/table.pxi:
##########
@@ -2822,7 +2822,7 @@ cdef class RecordBatch(_Tabular):
4 5 Brittle stars
5 100 Centipede
- Construct a RecordBartch from pyarrow Arrays using schema:
+ Construct a RecordBatch from pyarrow Arrays using schema:
Review Comment:
Thanks for catching this! 👍
##########
python/pyarrow/table.pxi:
##########
@@ -2822,7 +2822,7 @@ cdef class RecordBatch(_Tabular):
4 5 Brittle stars
5 100 Centipede
- Construct a RecordBartch from pyarrow Arrays using schema:
+ Construct a RecordBatch from pyarrow Arrays using schema:
Review Comment:
Thanks for catching 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]