Skip to content

Commit 2c49cd4

Browse files
committed
Some debugging
Change-Id: I47af06be9407c0b7eb39e0fb8cd37970e8eeeb67
1 parent ca1562b commit 2c49cd4

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

cpp/src/arrow/ipc/adapter.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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();

python/pyarrow/tests/test_ipc.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ def test_ipc_simple_roundtrip():
6060

6161
def 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)

python/src/pyarrow/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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() {

0 commit comments

Comments
 (0)