amoeba commented on code in PR #43740:
URL: https://github.com/apache/arrow/pull/43740#discussion_r1722697848
##########
python/pyarrow/_dataset.pyx:
##########
@@ -2505,6 +2505,28 @@ cdef class Partitioning(_Weakrefable):
result = self.partitioning.Parse(tobytes(path))
return Expression.wrap(GetResultValue(result))
+ def format(self, expr):
+ """
+ Parse a partition expression into a tuple of directory, path
+
+ Parameters
+ ----------
+ expr : pyarrow.dataset.Expression
+
+ Returns
+ -------
+ tuple[str, str]
+ """
Review Comment:
Adding an example would be good.
##########
python/pyarrow/_dataset.pyx:
##########
@@ -2505,6 +2505,28 @@ cdef class Partitioning(_Weakrefable):
result = self.partitioning.Parse(tobytes(path))
return Expression.wrap(GetResultValue(result))
+ def format(self, expr):
+ """
+ Parse a partition expression into a tuple of directory, path
Review Comment:
```suggestion
Convert a filter expression into a tuple of (directory, filename)
using
the current partitioning scheme
```
##########
python/pyarrow/_dataset.pyx:
##########
@@ -2505,6 +2505,28 @@ cdef class Partitioning(_Weakrefable):
result = self.partitioning.Parse(tobytes(path))
return Expression.wrap(GetResultValue(result))
+ def format(self, expr):
+ """
+ Parse a partition expression into a tuple of directory, path
+
+ Parameters
+ ----------
+ expr : pyarrow.dataset.Expression
+
+ Returns
+ -------
+ tuple[str, str]
+ """
+ cdef:
+ CResult[CPartitionPathFormat] result
+ CPartitionPathFormat result_value
+ result = self.partitioning.Format(
+ Expression.unwrap(expr)
+ )
+ result_value = GetResultValue(result)
+
+ return frombytes(result_value.directory),
frombytes(result_value.filename)
Review Comment:
Could the remainder of this be simplified with `CPartitionPathFormat.wrap`?
I'm not very familiar with Cython so let me know.
--
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]