-
Notifications
You must be signed in to change notification settings - Fork 0
fix for fix #1
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
fix for fix #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -480,18 +480,20 @@ where | |
| let mut nulls = null_indices; | ||
|
|
||
| let valids_len = valids.len(); | ||
| let nulls_len = nulls.len(); | ||
| let mut nulls_len = nulls.len(); | ||
| let mut len = values.len(); | ||
|
|
||
| if let Some(limit) = limit { | ||
| len = limit.min(len); | ||
| // count how many nulls are present in the limit | ||
| nulls_len = nulls.iter().filter(|&idx| *idx as usize <= limit).count(); | ||
| } | ||
| if !descending { | ||
| sort_by(&mut valids, len.saturating_sub(nulls_len), |a, b| { | ||
| sort_by(&mut valids, len - nulls_len, |a, b| { | ||
| cmp(a.1, b.1) | ||
| }); | ||
| } else { | ||
| sort_by(&mut valids, len.saturating_sub(nulls_len), |a, b| { | ||
| sort_by(&mut valids, len - nulls_len, |a, b| { | ||
| cmp(a.1, b.1).reverse() | ||
| }); | ||
| // reverse to keep a stable ordering | ||
|
|
@@ -1442,7 +1444,7 @@ mod tests { | |
| nulls_first: true, | ||
| }), | ||
| Some(3), | ||
| vec![None, None, Some(2)], | ||
| vec![None, Some(2), Some(0)], | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the checked in answers are incorrect -- namely the first three items in the input are
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this passing? This looks wrong to me, the unoptimized order (ie /wo limit) would look like |
||
| ); | ||
|
|
||
| test_sort_primitive_arrays::<Float32Type>( | ||
|
|
||
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.
Everything else in this function doesn't need to dig into the actual index values so something smells here to me. I thought the limit is applied to the sorted result so I don't know that comparing the limit to the indices is correct here.