Sorting by an embedded table's columns is clumsy
Closed this issue · 1 comments
spenczar commented
class Parent(Table):
child = Child.as_column()
class Child(Table):
x = Int64Column()
Sorting Parent
by the values of child.x
is not easy. You can't just do t.sort_by('child.x')
, since that's not a known field name on Parent.table
. So you do a whole sort_indices
rigamarole:
class Parent(Table):
...
def sort_by_x(self) -> Self:
indices = pyarrow.compute.sort_indices(self.child.x)
return self.take(indices)
This could be improved with a better API.