Skip to content

Fix infinite loop on WITH FILL for data starting with ±inf - #103580

Merged
alexey-milovidov merged 4 commits into
masterfrom
fix-inf-order-with-fill
May 1, 2026
Merged

alexey-milovidov merged 4 commits into
masterfrom
fix-inf-order-with-fill

Conversation

@thevar1able

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix infinite loop on WITH FILL for data starting with ±inf.

Closes #102873

@thevar1able
thevar1able marked this pull request as draft April 27, 2026 05:21
@clickhouse-gh

clickhouse-gh Bot commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5763b02]

Summary: ✅


AI Review

Summary

This PR fixes a real correctness issue in WITH FILL when filling starts from +inf or -inf: FillingRow::next now stops generation when the current fill value is non-finite, avoiding non-progressing iterations that can loop forever. The added stateless tests cover both -inf (ascending) and +inf (descending) starting points, and I did not find additional blocker/major issues in the changed scope.

Missing context
  • ⚠️ No CI run logs/results were provided in this review context.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Apr 27, 2026
@thevar1able
thevar1able marked this pull request as ready for review May 1, 2026 04:17
@clickhouse-gh

clickhouse-gh Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.10% +0.00%
Functions 91.10% 91.10% +0.00%
Branches 76.60% 76.50% -0.10%

Changed lines: 100.00% (6/6) · Uncovered code

Full report · Diff report

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok. Usually we prefer adding new tests instead of editing existing ones (as it helps with the analysis on the test run history).

@alexey-milovidov alexey-milovidov self-assigned this May 1, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue May 1, 2026
Merged via the queue into master with commit 28d95fc May 1, 2026
165 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-inf-order-with-fill branch May 1, 2026 09:15
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 1, 2026
@clickgapai

Copy link
Copy Markdown
Contributor

Hi — this PR may need backporting to 26.3 (LTS), 26.2, 26.1, 25.8 (LTS), but no backport label was found.

Affected code: FillingRow::next in src/Interpreters/FillingRow.cpp — core code present in all supported branches.

Why: FillingRow::next in src/Interpreters/FillingRow.cpp predates all currently supported release branches (file was created well before the 25.8 LTS branch cut). The bug is reachable from any user-supplied SQL of the form ORDER BY <float_col> WITH FILL when the first row contains ±Inf — easy to trigger and produces unbounded memory consumption until OvercommitTracker fails the query.

If this should be backported, consider adding pr-must-backport or a version-specific label (e.g. v26.3-must-backport). Ignore this if backporting is not applicable.

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 pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FillingRow::next missing NaN/Inf check on row[pos] causes infinite loop when data starts with ±inf

4 participants