chilin0525 commented on code in PR #49355:
URL: https://github.com/apache/arrow/pull/49355#discussion_r2896460931
##########
docs/source/python/dataset.rst:
##########
@@ -569,6 +569,29 @@ calculate the average of a column without loading the
entire column into memory:
... count += batch.num_rows
>>> mean_a = col2_sum/count
+The ``filter`` argument of :meth:`Dataset.to_batches` (and
:func:`~Dataset.to_table`)
+expects a boolean :class:`~pyarrow.dataset.Expression`, which can be
constructed using
+:func:`pyarrow.dataset.field` and its operator overloads. However, if you
already have
+filters in the DNF (Disjunctive Normal Form) list-of-tuples format accepted by
+:class:`pyarrow.parquet.ParquetDataset`, you can convert them to an
``Expression``
+using :func:`pyarrow.parquet.filters_to_expression`:
+
+.. code-block:: python
+
+ >>> import pyarrow.parquet as pq
+ >>> import pyarrow.compute as pc
+ >>> dataset = ds.dataset(base / "parquet_dataset", format="parquet")
Review Comment:
That makes sense. Thanks for the suggestion. 🙏
--
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]