File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,6 +165,8 @@ class RecordBatchWriter {
165165
166166 // The buffer might be null if we are handling zero row lengths.
167167 if (buffer) {
168+ DCHECK (buffer->capacity () >= buffer->size ());
169+
168170 // We use capacity here, because size might not reflect the padding
169171 // requirements of buffers but capacity always should.
170172 size = buffer->capacity ();
Original file line number Diff line number Diff line change @@ -60,9 +60,12 @@ def test_ipc_simple_roundtrip():
6060
6161def big_batch ():
6262 df = pd .DataFrame (
63- np .random .randn (2 ** 4 , 2 ** 23 ).T ,
63+ np .random .randn (2 ** 4 , 2 ** 20 ).T ,
6464 columns = [str (i ) for i in range (2 ** 4 )]
6565 )
66+
67+ df = pd .concat ([df ] * 2 ** 3 , ignore_index = True )
68+
6669 return A .RecordBatch .from_pandas (df )
6770
6871
@@ -82,3 +85,6 @@ def read_file(source):
8285 reader = ipc .ArrowFileReader (source )
8386 return [reader .get_record_batch (i )
8487 for i in range (reader .num_record_batches )]
88+
89+ batch = big_batch ()
90+ mem = write_to_memory (batch )
Original file line number Diff line number Diff line change @@ -120,6 +120,7 @@ class PYARROW_EXPORT NumPyBuffer : public arrow::Buffer {
120120
121121 data_ = reinterpret_cast <const uint8_t *>(PyArray_DATA (arr_));
122122 size_ = PyArray_SIZE (arr_);
123+ capacity_ = size_;
123124 }
124125
125126 virtual ~NumPyBuffer () {
You can’t perform that action at this time.
0 commit comments