amol- commented on code in PR #14976:
URL: https://github.com/apache/arrow/pull/14976#discussion_r1054510676


##########
python/pyarrow/table.pxi:
##########
@@ -4758,11 +4758,11 @@ cdef class Table(_PandasConvertible):
         if isinstance(sorting, str):
             sorting = [(sorting, "ascending")]
 
-        indices = _pc().sort_indices(
-            self,
-            options=_pc().SortOptions(sort_keys=sorting, **kwargs)
-        )
-        return self.take(indices)
+        res = _pc()._exec_plan._sort_source(self, output_type=Table,
+                                            sort_options=_pc().SortOptions(
+                                                sort_keys=sorting, **kwargs
+                                            ))

Review Comment:
   I didn't benchmark it, I can if you want to have numbers, but I guessed that 
it's faster to do the whole operation in C++ once than having to sort indices 
and create a temporary arrays of indices just to then take the actual values 
from the table.



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

Reply via email to