apache / apache/arrow

[Python] Segfault when turning parquet dataset into table with a filter

Open
#43,558 1 comment 0 reactions 0 assignees View on GitHub
Component: Parquet Component: Python 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.

This appears to be a regression between `pyarrow-15.0.2` and `pyarrow-16.0.0`. This issue is still present in `pyarrow-17.0.0`.

The following occasionally throws segfaults when reading parquet files from S3.

```python
import pyarrow.dataset as ds
from pyarrow.fs import S3FileSystem

ts = ds.field('timestamp')
dataset = ds.dataset(
source=['a', 'b', 'c'],
format=ds.ParquetFileFormat(),
filesystem=S3FileSystem(),
partitioning='hive',
)
dataset.to_table(filter=(ts > start_ts) & (ts <= end_ts))
```

However this consistently works even when the above segfaults

```python
import pyarrow.dataset as ds
import pyarrow.compute as pc
from pyarrow.fs import S3FileSystem

ts = pc.field('timestamp')
dataset = ds.dataset(
source=['a', 'b', 'c'],
format=ds.ParquetFileFormat(),
filesystem=S3FileSystem(),
partitioning='hive',
)
table = dataset.to_table()
table.filter((ts > start_ts) & (ts <= end_ts))
```

Few other miscellaneous details
* The timestamp field is a `pa.timestamp('ns')`
* `start_ts` and `end_ts` are pandas timestamps
* The base environment is the docker image `python:3.10-slim-bookworm`

### Component(s)

Parquet, Python

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.