pitrou commented on code in PR #54919:
URL: https://github.com/apache/arrow/pull/54919#discussion_r4348752621
##########
python/pyarrow/tests/parquet/test_basic.py:
##########
@@ -1075,3 +1075,47 @@ def
test_read_table_raises_value_error_when_ds_is_unavailable(monkeypatch, sourc
with pytest.raises(ValueError, match="the 'source' argument"):
pq.read_table(source=source)
+
+
[email protected]
+def proxy_pool():
+ # Owned by the fixture so that it outlives every object created from it
+ # inside the test function (readers and tables keep a raw pool pointer).
+ return pa.proxy_memory_pool(pa.default_memory_pool())
+
+
[email protected]("use_dataset_path", [True, False])
+def test_read_table_memory_pool(tempdir, proxy_pool, use_dataset_path,
+ monkeypatch):
+ table = pa.table({'a': list(range(1000)),
+ 'b': [str(i) for i in range(1000)]})
+ path = str(tempdir / 'data.parquet')
+ pq.write_table(table, path)
+
+ if not use_dataset_path:
+ # Exercise the ParquetFile fallback used without pyarrow.dataset
+ monkeypatch.setitem(sys.modules, "pyarrow.dataset", None)
+
+ result = pq.read_table(path, memory_pool=proxy_pool)
+ assert result.equals(table)
+ assert proxy_pool.max_memory() > 0
Review Comment:
How about we exercise this a bit more specifically, such as:
```suggestion
assert proxy_pool.bytes_allocated() >= table.nbytes
result = None
assert proxy_pool.bytes_allocated() == 0
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]