Skip to content

Fix behaviour of quantileDeterministic function#25313

Merged
alexey-milovidov merged 3 commits intomasterfrom
fix-quantile-determinism
Jun 16, 2021
Merged

Fix behaviour of quantileDeterministic function#25313
alexey-milovidov merged 3 commits intomasterfrom
fix-quantile-determinism

Conversation

@alexey-milovidov
Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix the possibility of non-deterministic behaviour of the quantileDeterministic function and similar. This closes #20480.

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Jun 16, 2021
{
setSkipDegree(skip_degree + 1);

/// Still good?
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix.

In previous version, the value is not being filtered after coarsening, so one excessive value can appear in the final reservoir.

class ReservoirSamplerDeterministic
{
bool good(const UInt32 hash)
private:
Copy link
Copy Markdown
Member Author

@alexey-milovidov alexey-milovidov Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is old code (circa 2014), it also contains hairy decisions and mistakes. E.g. total_values is calculated and serialized but not used.

@alexey-milovidov
Copy link
Copy Markdown
Member Author

Functional stateless tests flaky check (address) — fail: 66, passed: 234

This is fine.

@alexey-milovidov alexey-milovidov merged commit 0e16ddd into master Jun 16, 2021
@alexey-milovidov alexey-milovidov deleted the fix-quantile-determinism branch June 16, 2021 22:24
@alexey-milovidov alexey-milovidov self-assigned this Jun 16, 2021
alexey-milovidov added a commit that referenced this pull request Jun 17, 2021
Backport #25313 to 21.6: Fix behaviour of quantileDeterministic function
alexey-milovidov added a commit that referenced this pull request Jun 17, 2021
Backport #25313 to 21.3: Fix behaviour of quantileDeterministic function
alexey-milovidov added a commit that referenced this pull request Jun 17, 2021
Backport #25313 to 21.5: Fix behaviour of quantileDeterministic function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quantileDeterministic and friends are not deterministic

2 participants