Uh oh!
There was an error while loading. Please reload this page.
ARROW-14656: [Python] sort helper for Array, ChunkedArray and StructArray - #11659
ARROW-14656: [Python] sort helper for Array, ChunkedArray and StructArray#11659amol- wants to merge 28 commits into
Conversation
There was a problem hiding this comment.
It seems a bit strange to have this method only on StructArray IMO. Also for other arrays, sorting takes some effort with the current API.
There was a problem hiding this comment.
This is sorting by a given child field. So it wouldn't make sense on other arrays (including unions).
There was a problem hiding this comment.
But it does make sense to sort just the array.
What I mean is, also for sorting an array, it takes some code:
arr.take(pc.array_sort_indices(arr, order))
vs for struct array:
arr.take(pc.array_sort_indices(arr.field(name), order)
Once you have the first snippet, I don't see why the second snippet would necessarily warrant a helper function (and the first not)
There was a problem hiding this comment.
Well, we can expose both if we want, though @amol- 's ticket seems to be specifically for sort_by :-)
There was a problem hiding this comment.
I know, but so my feedback is that I am personally -1 on adding a special case method sort_by
There was a problem hiding this comment.
I think it would be resonable to rename the method to StructArray.sort and add it to all Arrays. The signature would be different between them (as in StructArray you have to provide the field argument) but apart from that we can provide a sort method for all arrays and it would have value as it would still prevent combining multiple compute functions to achieve the wanted result.
amol-
commented
Nov 22, 2021
This is currently blocked by:
|
pitrou
commented
Nov 22, 2021
@amol- Why don't you just |
amol-
commented
Nov 22, 2021
That's what I'm ending up doing for |
jorisvandenbossche
commented
Nov 22, 2021
Yes, using "dummy" name is also what we do elsewhere: arrow/python/pyarrow/compute.py Lines 722 to 723 in 92ee295 |
There was a problem hiding this comment.
This should be revert to omit the fieldname, it was the acceeptance test for sorting struct arrays wiithout any specific field.
There was a problem hiding this comment.
This should be revert to omit the fieldname, it was the acceeptance test for sorting struct arrays wiithout any specific field.
support for Table and RecordBatch to NestedValuesComparator
pitrou
commented
May 4, 2022
@amol- What is the status on this? Do you want to take it up? |
amol-
commented
May 4, 2022
Jedi18
commented
May 4, 2022
Yes I'll probably not get the time to take this on at least till June, so please feel free to assign it to someone else. Sorry for holding up this PR for so long! |
No description provided.