This is an automated email from the ASF dual-hosted git repository.
westonpace pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new f7fbfcafde GH-34428: [Python][Docs] Add docsstring for `make_fragment`
(#34429)
f7fbfcafde is described below
commit f7fbfcafdebc37cfcd0ef76b68434497ffa4275a
Author: Fokko Driesprong <[email protected]>
AuthorDate: Tue Mar 7 17:50:45 2023 +0100
GH-34428: [Python][Docs] Add docsstring for `make_fragment` (#34429)
* Closes: #34428
Lead-authored-by: Fokko Driesprong <[email protected]>
Co-authored-by: Fokko Driesprong <[email protected]>
Co-authored-by: Weston Pace <[email protected]>
Signed-off-by: Weston Pace <[email protected]>
---
python/pyarrow/_dataset.pyx | 10 ++++++++--
python/pyarrow/_dataset_parquet.pyx | 21 +++++++++++++++++++++
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/python/pyarrow/_dataset.pyx b/python/pyarrow/_dataset.pyx
index 8bb1a0a1cb..11296b53d9 100644
--- a/python/pyarrow/_dataset.pyx
+++ b/python/pyarrow/_dataset.pyx
@@ -1234,8 +1234,14 @@ cdef class FileFormat(_Weakrefable):
filesystem : Filesystem, optional
If `filesystem` is given, `file` must be a string and specifies
the path of the file to read from the filesystem.
- partition_expression : Expression
- The filter expression.
+ partition_expression : Expression, optional
+ An expression that is guaranteed true for all rows in the
fragment. Allows
+ fragment to be potentially skipped while scanning with a filter.
+
+ Returns
+ -------
+ fragment : Fragment
+ The file fragment
"""
if partition_expression is None:
partition_expression = _true
diff --git a/python/pyarrow/_dataset_parquet.pyx
b/python/pyarrow/_dataset_parquet.pyx
index 01a3b30da5..d3ceca85e8 100644
--- a/python/pyarrow/_dataset_parquet.pyx
+++ b/python/pyarrow/_dataset_parquet.pyx
@@ -209,6 +209,27 @@ cdef class ParquetFileFormat(FileFormat):
def make_fragment(self, file, filesystem=None,
Expression partition_expression=None, row_groups=None):
+ """
+ Make a FileFragment from a given file.
+
+ Parameters
+ ----------
+ file : file-like object, path-like or str
+ The file or file path to make a fragment from.
+ filesystem : Filesystem, optional
+ If `filesystem` is given, `file` must be a string and specifies
+ the path of the file to read from the filesystem.
+ partition_expression : Expression, optional
+ An expression that is guaranteed true for all rows in the
fragment. Allows
+ fragment to be potentially skipped while scanning with a filter.
+ row_groups : Iterable, optional
+ The indices of the row groups to include
+
+ Returns
+ -------
+ fragment : Fragment
+ The file fragment
+ """
cdef:
vector[int] c_row_groups