-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement sorted flags for struct series #21290
feat: Implement sorted flags for struct series #21290
Conversation
Already implemented in `impl ChunkSort<StructType> for StructChunked`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #21290 +/- ##
==========================================
+ Coverage 79.82% 79.89% +0.06%
==========================================
Files 1596 1596
Lines 228565 228562 -3
Branches 2608 2608
==========================================
+ Hits 182462 182618 +156
+ Misses 45507 45348 -159
Partials 596 596 ☔ View full report in Codecov by Sentry. |
@@ -645,26 +644,20 @@ impl ChunkSort<BinaryOffsetType> for BinaryOffsetChunked { | |||
} | |||
} | |||
|
|||
#[cfg(feature = "dtype-struct")] | |||
impl StructChunked { | |||
pub(crate) fn arg_sort(&self, options: SortOptions) -> IdxCa { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed? Was it unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this method was left over when ChunkSort
was implemented for structs in #17522. A method with the same name, signature and implementation was added in ChunkSort
impl and now some calls resolve to this one and some to the ChunkSort
one. I removed it, because it is duplicate code, confusing to read, and a potential footgun if the implementations are not kept in sync.
This is the situation:
impl StructChunked {
// <<< A >>> only used in `sort_with` below and one other place
pub(crate) fn arg_sort(&self, options: SortOptions) -> IdxCa {
let bin = _get_rows_encoded_ca(...).unwrap(); // same impl as B, just `get_row_encoded` inlined
bin.arg_sort(Default::default())
}
}
impl ChunkSort<StructType> for StructChunked {
fn sort_with(&self, mut options: SortOptions) -> ChunkedArray<StructType> {
...
let idx = self.arg_sort(options); // Looks like it calls B, but actually calls A
...
}
fn sort(&self, descending: bool) -> ChunkedArray<StructType> {
self.sort_with(...) // Also calls A through `sort_with`
}
// <<< B >>> used in `T: ChunkSort` generic contexts
fn arg_sort(&self, options: SortOptions) -> IdxCa {
let bin = self.get_row_encoded(options).unwrap();
bin.arg_sort(Default::default())
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, now I see.
This PR implements sorted flags for struct series.
It removes a duplicate
StructChunked::arg_sort
function, it exists inChunkSort<StructType> for StructChunked
with the same name and implementation.Closes #13484