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

Simplify TopKSelectorTest.testExceedMaxIteration() #5698

Closed
wants to merge 1 commit into from
Closed

Simplify TopKSelectorTest.testExceedMaxIteration() #5698

wants to merge 1 commit into from

Conversation

perceptron8
Copy link
Contributor

No description provided.

@google-cla google-cla bot added the cla: yes label Aug 30, 2021
@perceptron8
Copy link
Contributor Author

perceptron8 commented Aug 30, 2021

k = 7 is minimum for which TopKSelector.trim can fall back to Arrays.sort as it is minimum k for which 2 * k - 1 >= ceil(log2(2 * k - 1)) * 3.

Test data was found by concatenating every possible permutation of [1..k] with k copies of [0]. Luckily, one of such concatenations triggers off-by-one error in TopKSelector (or at least was triggering before #5691).

@nick-someone
Copy link
Member

Thanks for the reduction case! This will be merged internally, then pushed back out, attributed to you.

@nick-someone nick-someone self-assigned this Sep 2, 2021
copybara-service bot pushed a commit that referenced this pull request Sep 3, 2021
Fixes #5698

RELNOTES=n/a
PiperOrigin-RevId: 394549848
@copybara-service copybara-service bot closed this in f28b8db Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants