You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/12/21 15:22:40 UTC
[GitHub] [arrow] amol- commented on a diff in pull request #14976: GH-14975: [Python] Dataset.sort_by
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org