Repository navigation
Check for query cancellation in h3PolygonToCells - #101042
Merged
Merged
Conversation
…k in stress tests The function processes all rows in a tight loop calling H3 library functions (`maxPolygonToCellsSize` + `polygonToCells`) without ever checking if the query has been cancelled. Under MSan, these calls are extremely slow, and a query like `SELECT DISTINCT h3PolygonToCells(ring, 7) FROM rings` on 10,000 rows can run for ~30 minutes, ignoring `max_execution_time` and triggering the hung check in stress tests. Add a per-row check of `QueryStatus::isKilled` (a single atomic bool load) so the function respects cancellation. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100277&sha=53fa68604439a19ba43fbb7a772fb0f95a520e69&name_0=PR&name_1=Stress%20test%20%28amd_msan%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [1b37a00] Summary: ✅ AI ReviewSummaryThis PR updates ClickHouse Rules
Final Verdict
|
Contributor
LLVM Coverage Report
Changed lines: 94.74% (18/19) · Uncovered code |
alexey-milovidov
left a comment
Member
Author
There was a problem hiding this comment.
This will fix "hung check" in stress tests.
1 task
This was referenced Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
h3PolygonToCellsfunction processes all rows in a tight loop calling H3 library functions (maxPolygonToCellsSize+polygonToCells) without ever checking if the query has been cancelled. Under MSan, these calls are extremely slow (~10-50x), and a query on 10,000 rows can run for ~30 minutes, ignoringmax_execution_timeand triggering the hung check in stress tests.Add a per-row check of
QueryStatus::isKilled(a singlestd::atomic<bool>load — essentially free) so the function respects cancellation.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100277&sha=53fa68604439a19ba43fbb7a772fb0f95a520e69&name_0=PR&name_1=Stress%20test%20%28amd_msan%29
#100277
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
h3PolygonToCellsfunction now respects query cancellation (max_execution_time,KILL QUERY), preventing it from running indefinitely on large inputs.Documentation entry for user-facing changes
Author's comment: I'd not consider this approach, but the function is extremely slow, and its code is heavyweight, so this is normal.
Version info
26.4.1.404