bkietz commented on a change in pull request #7026:
URL: https://github.com/apache/arrow/pull/7026#discussion_r416760152



##########
File path: python/pyarrow/_dataset.pyx
##########
@@ -118,21 +280,15 @@ cdef class Dataset:
         -------
         fragments : iterator of Fragment
         """
-        cdef:
-            CFragmentIterator iterator
-            shared_ptr[CFragment] fragment
+        cdef CFragmentIterator c_fragments
 
         if filter is None or filter.expr == nullptr:
-            iterator = self.dataset.GetFragments()
+            c_fragments = self.dataset.GetFragments()
         else:
-            iterator = self.dataset.GetFragments(filter.unwrap())
+            c_fragments = self.dataset.GetFragments(filter.unwrap())
 
-        while True:
-            fragment = GetResultValue(iterator.Next())
-            if fragment.get() == nullptr:
-                raise StopIteration()
-            else:
-                yield Fragment.wrap(fragment)
+        for maybe_fragment in c_fragments:

Review comment:
       actually all elements are `CResult[shared_ptr[CFragment]]`




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to