apache / apache/arrow

[Python][C++] Crash when performing `join` on a table larger than INT32_MAX bytes

Open
#36,879 1 comment 2 reactions 0 assignees View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

pyarrow version: 12.0.1

Minimal Repro:
```python
import pyarrow as pa

ROW_COUNT = 15_000
query = pa.Table.from_pydict({
"key": [bytes.fromhex('ABC123'), bytes.fromhex('DEF431')]
})
t = pa.Table.from_pydict(
{
"blob_2": [x.to_bytes(4, 'little') * 25_000 for x in range(ROW_COUNT)],
"blob_1": [x.to_bytes(4, 'little') * 25_000 for x in range(ROW_COUNT)],
"key": [x.to_bytes(4, 'little') for x in range(ROW_COUNT)]
},
schema=pa.schema(
[
("blob_2", pa.large_binary()),
("blob_1", pa.large_binary()),
("key", pa.binary()),
]
)
)
print(f"Table size: {t.nbytes} bytes (bigger than INT_MAX: {t.nbytes > (1 << 31)})")
for x in range(10):
print(f"Attempt {x}")
_ = query.join(t, 'key', join_type="inner")

```

Executing this results in a segfault:
```
terminate called after throwing an instance of 'std::length_error'
what(): vector::_M_default_append
```

Note that flipping the join (e.g. `_ = t.join(q, 'key', join_type="inner")`) no longer segfaults.

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.