Skip to content
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

bug: ReorderSort does not work as expected #274

Closed
creatorrr opened this issue Jul 29, 2024 · 4 comments
Closed

bug: ReorderSort does not work as expected #274

creatorrr opened this issue Jul 29, 2024 · 4 comments

Comments

@creatorrr
Copy link
Contributor

creatorrr commented Jul 29, 2024

ReorderSort does not return anything. Am I doing something wrong? @zh217

Query:

test[a] <- [[1], [2], [3]]

?[i, x] <~ ReorderSort(test[a], out: [a], sort_by: [-a])

Expected:

i x
1 3
2 2
3 1

Actual:

i x
@wti
Copy link
Contributor

wti commented Aug 12, 2024

Working for me with take: n != 0 e.g.,

test[a] <- [[1], [2], [3]]

?[i, x] <~ ReorderSort(test[a], out: [a], sort_by: [-a], take: 10)

So it looks like the default value for take of 0 does not have the documented magic significance of unbounded.

@wti
Copy link
Contributor

wti commented Aug 12, 2024

See

if count > take_plus_skip {

perhaps:

if 0 != count && count > take_plus_skip {
    break;
}

@wti
Copy link
Contributor

wti commented Aug 12, 2024

Proposed fix in PR #277

@creatorrr
Copy link
Contributor Author

Ah that makes sense! Thanks for the catch and the fix 😄 Closing

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants