18 Commits
Author SHA1 Message Date
Raúl Cumplido 3f4a04ee9f GH-50277: [CI][Python] Avoid using generators for test parametrization on newer Pytest (#50278)
### Rationale for this change

On the hypothesis tests we treat Warnings as errors and the job has been failing with the latest Pytest version (9.1.0). This is related to:
- https://github.com/pytest-dev/pytest/issues/13409

With the latest pytest using generators for parametrization has been deprecated.

### What changes are included in this PR?

Change the generator that was causing the failures and return a list of supported_factories instead.

### Are these changes tested?

Yes both locally and the archery test that was failing.

### Are there any user-facing changes?

No

* GitHub Issue: #50277

Authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
2026-06-30 09:21:58 +02:00
Sutou Kouhei ddc422944e GH-49295: [Python] Remove "mimalloc" from mandatory_backends (#49645)
### Rationale for this change

mimalloc is enabled by default but users can disable it. For example, Debian package disables it.

If it's disabled, PyArrow tests are failed.

### What changes are included in this PR?

Remove `"mimalloc"` from `mandatory_backends` in our test.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* GitHub Issue: #49295

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-04-03 09:03:08 +09:00
Nuno Veloso 6fee049c81 GH-18036: [Packaging] Build Python wheel for musllinux (#45470)
### Rationale for this change
Please check #18036.

### What changes are included in this PR?

Almost everything needed for building and testing Python wheels for musllinux.
The side-effect of these changes are the exclusion of 2 unit tests when running on musl based systems.
The skipped unit tests are:
- test_uwsgi_integration
- test_print_stats

### Are these changes tested?

I was able to successfully generate a musllinux wheel by running the following:
 
```
docker-compose build python-wheel-musllinux-1-2
docker-compose run python-wheel-musllinux-1-2
```

I was also able to run the following tests with no errors:

```
python-wheel-musllinux-test-imports
python-free-threaded-wheel-musllinux-test-imports
python-wheel-musllinux-test-unittests
python-free-threaded-wheel-musllinux-test-unittests
```

### Are there any user-facing changes?

Yes.
* GitHub Issue: #18036

Authored-by: Nuno Veloso <nveloso21@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2025-03-27 10:22:20 +09:00
Antoine Pitrou ac1e7ec6c2 GH-45358: [C++][Python] Add MemoryPool method to print statistics (#45359)
### Rationale for this change

Add a MemoryPool method to print allocator-specific statistics to stderr, to help diagnose perceived memory consumption issues.

Also add missing Python bindings for `MemoryPool::total_bytes_allocated` and `MemoryPool::num_allocations`.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.

* GitHub Issue: #45358

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2025-01-27 15:11:24 +01:00
Antoine Pitrou f9a6edac9f GH-45006: [CI][Python] Fix test_memory failures (#45007)
`test_memory.py` has started failing on some builds after https://github.com/apache/arrow/pull/44951 was merged

* GitHub Issue: #45006

Lead-authored-by: Antoine Pitrou <pitrou@free.fr>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2024-12-13 16:36:02 +01:00
Sutou Kouhei 27e56f01e8 GH-44342: [C++] Disable jemalloc by default on ARM (#44380)
### Rationale for this change

jemalloc may have a problem on ARM.
See also: https://github.com/apache/arrow/issues/44342

### What changes are included in this PR?

* Disable jemalloc by default on ARM.
* Disable jemalloc for manylinux wheel for ARM.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.

* GitHub Issue: #44342

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
2024-10-14 12:57:47 +02:00
2de8008748 GH-41910: [Python] Add support for Pyodide (#37822)
pyarrow knows about ARROW_ENABLE_THREADING and doesn't use threads if they are not enabled in libarrow.

Split from #37696 

* GitHub Issue: #41910

Lead-authored-by: Joe Marshall <joe.marshall@nottingham.ac.uk>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2024-07-06 06:17:25 +09:00
Rossi Sun a946214b12 GH-39973: [C++][CI] Disable debug memory pool for ASAN and Valgrind (#39975)
### Rationale for this change

Disable debug memory pool for ASAN and Valgrind so that they can detect more subtle memory issues regarding to buffer tail bytes.

### What changes are included in this PR?

1. Add a `none` option to debug memory pool env var to make other things slightly easier.
2. Change `*_test.sh` scripts to conditionally set debug memory pool env var.
3. Top-level docker compose change to pass none to debug memory pool env var for ASAN and Valgrind.

### Are these changes tested?

The CI should cover it well.

### Are there any user-facing changes?

No.

* Closes: #39973

Authored-by: Ruoxi Sun <zanmato1984@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2024-02-08 18:02:04 +01:00
h-vetinariandSutou Kouhei 47e438adf7 GH-15017: [Python] Harden test_memory.py for use with ARROW_USE_GLOG=ON (#36901)
Accept output pattern for ARROW_USE_GLOG=ON too.

* Closes: #15017

Lead-authored-by: H. Vetinari <h.vetinari@gmx.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2023-07-28 11:31:01 +09:00
Raúl Cumplido 85f0db26ed ARROW-16873: [Python] Disable faulthandler on spawned child subprocess on run_debug_memory_pool tests (#13461)
Authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2022-06-30 05:55:20 +09:00
Antoine Pitrou 85622005d1 MINOR: [Python] Make ARROW_DEBUG_MEMORY_POOL test more robust
When writing out of bounds and ARROW_DEBUG_MEMORY_POOL isn't set, the test subprocess may crash depending on the underlying allocator.

Closes #12595 from pitrou/minor-test-memory-py

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-03-10 11:43:43 +01:00
Antoine Pitrou d6e577899f ARROW-15550: [C++] Add optional debug memory checks
Debug memory checks can be enabled by setting the environment variable ARROW_DEBUG_MEMORY_POOL
to one of the recognized values "abort", "trap" or "warn" (regardless of whether Arrow
was compiled in debug or release mode).

The only implemented check adds a suffix past the allocation and checks that it isn't clobbered on deallocation.
Adding a prefix would be more expensive because of alignment constraints.

Also add a fix by Will Jones for ARROW-14047 (Parquet Arrow reader sets null values in buffer overflow), since otherwise CI would fail.

Closes #12330 from pitrou/ARROW-15550-debug-memory-checks

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-02-09 09:44:12 +01:00
Will Jones 09f23ed7fd ARROW-15109: [Python] Add show_info() to print build, component, and system info
It's helpful to know which optional components are enabled, particularly if the user has done a custom build of PyArrow. This is inspired by the `arrow_info()` function in the R bindings.

I'm open to other suggestions of info to include.

## Example Output

<details open>
  <summary>Before</summary>

```sh
pyarrow version info
--------------------
Package kind: not indicated
Arrow C++ library version: 6.0.1
Arrow C++ compiler: Clang 11.1.0
Arrow C++ compiler flags: -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -isystem /Users/willjones/.pyenv/versions/miniforge3/include -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/arrow-cpp-ext_1637415641039/work=/usr/local/src/conda/arrow-cpp-6.0.1 -fdebug-prefix-map=/Users/willjones/.pyenv/versions/miniforge3=/usr/local/src/conda-prefix -Qunused-arguments -fcolor-diagnostics -O3 -DNDEBUG
Arrow C++ git revision:
Arrow C++ git description:
```
</details>

<details open>
  <summary>After</summary>

```sh
❯ python -c "import pyarrow; pyarrow.show_info()"
pyarrow version info
--------------------
Package kind              : not indicated
Arrow C++ library version : 7.0.0-SNAPSHOT
Arrow C++ compiler        : AppleClang 13.0.0.13000027
Arrow C++ compiler flags  :  -Qunused-arguments -fcolor-diagnostics -ggdb -O0
Arrow C++ git revision    : f738b7d025546d594f4196707aed946b3ee3c4c0
Arrow C++ git description : apache-arrow-7.0.0.dev-422-gf738b7d02-dirty

Platform:
  OS / Arch           : Darwin arm64
  SIMD Level          : none
  Detected SIMD Level : none

Memory:
  Default backend     : mimalloc
  Bytes allocated     : 0 bytes
  Max memory          : 0 bytes
  Supported Backends  : mimalloc, jemalloc, system

Optional modules:
  csv                 : Enabled
  cuda                : -
  dataset             : Enabled
  feather             : Enabled
  flight              : Enabled
  fs                  : Enabled
  gandiva             : Enabled
  json                : Enabled
  orc                 : -
  parquet             : Enabled
  plasma              : Enabled

Filesystems:
  HadoopFileSystem    : -
  S3FileSystem        : -
  GcsFileSystem       : -

Compression Codecs:
  brotli              : Enabled
  bz2                 : Enabled
  gzip                : Enabled
  lz4_frame           : Enabled
  lz4                 : Enabled
  snappy              : Enabled
  zstd                : Enabled
```
</details>

Closes #12077 from wjones127/ARROW-15109-show-versions

Authored-by: Will Jones <willjones127@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-01-19 11:26:29 +01:00
Weston PaceandAntoine Pitrou 0a0c9f919d ARROW-12584: [C++][Python] Expose method for benchmarking tools to release unused memory from the allocators
@pitrou What are your thoughts on this.  It's not urgent (benchmarking can always use the system allocator in the meantime if they are having RAM issues and I think they reduced already which benchmarks they run on the RAM-limited servers)

With mimalloc the following command has a max RSS of ~16GB.
```
conbench file-read fanniemae_2016Q4 --all=true
```

If I add a call to release_unused between runs then the max RSS drops to ~10GB.

Closes #10186 from westonpace/feature/ARROW-12584--c-python-expose-method-for-benchmarking-tools

Lead-authored-by: Weston Pace <weston.pace@gmail.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-05-12 16:53:27 +02:00
Antoine Pitrou a91040f99e ARROW-11049: [Python] Expose alternate memory pools
Closes #9161 from pitrou/ARROW-11049-py-memory-pools

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-01-12 16:57:29 +01:00
Antoine Pitrou 053f4742c7 ARROW-11009: [C++] Allow changing default memory pool with an environment variable
ARROW_DEFAULT_MEMORY_POOL can take the name of the desired memory pool backend
('jemalloc', 'mimalloc', 'system').

Closes #9105 from pitrou/ARROW-11009-memory-pool-env-var

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
2021-01-11 09:28:53 -05:00
Antoine Pitrou a4eb08d54e ARROW-9469: [Python] Make more objects weakrefable
By default, Cython extension classes (defined with "cdef class") don't have a weakref slot, so add one to all of them.

This adds just one memory word to each object, which IMHO is acceptable.

Closes #7758 from pitrou/ARROW-9469-py-weakrefable-objects

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
2020-07-29 12:24:36 +02:00
Antoine Pitrou ed8e566081 ARROW-2808: [Python] Add MemoryPool tests
Also expand the exposed API a bit.

Author: Antoine Pitrou <antoine@python.org>

Closes #2725 from pitrou/ARROW-2808-python-memory-pool-tests and squashes the following commits:

7507891d <Antoine Pitrou> Re-use common constructor test
463e52d4 <Antoine Pitrou> ARROW-2808:  Add MemoryPool tests
2018-10-10 13:26:56 +02:00