Skip to content

fix(sql): overflow in materialized view refresh step calculation on large sample by interval#6258

Merged
bluestreak01 merged 3 commits intomasterfrom
puzpuzpuz_mat_view_refresh_step_overflow
Oct 10, 2025
Merged

fix(sql): overflow in materialized view refresh step calculation on large sample by interval#6258
bluestreak01 merged 3 commits intomasterfrom
puzpuzpuz_mat_view_refresh_step_overflow

Conversation

@puzpuzpuz
Copy link
Copy Markdown
Contributor

Fixes #6257

SampleByIntervalIterator got an overflow when calculating the high boundary on large SAMPLE BY intervals and relatively large step value. This is fixed by introducing a new cairo.mat.view.max.refresh.step configuration property (1y by default). The property defines maximum step interval after which refresh falls back to a single SAMPLE BY interval. Example: if refresh job calculates the step of 100 SAMPLE BY 2y intervals, after the check it will fall back to a single 2y interval to avoid overflow issues.

@puzpuzpuz puzpuzpuz self-assigned this Oct 10, 2025
@puzpuzpuz puzpuzpuz added Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution Materialized View and removed SQL Issues or changes relating to SQL execution labels Oct 10, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 10, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch puzpuzpuz_mat_view_refresh_step_overflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@glasstiger
Copy link
Copy Markdown
Contributor

[PR Coverage check]

😍 pass : 12 / 15 (80.00%)

file detail

path covered line new line coverage
🔵 io/questdb/cairo/DefaultCairoConfiguration.java 0 1 00.00%
🔵 io/questdb/cairo/mv/MatViewRefreshJob.java 8 10 80.00%
🔵 io/questdb/PropServerConfiguration.java 2 2 100.00%
🔵 io/questdb/PropertyKey.java 1 1 100.00%
🔵 io/questdb/cairo/CairoConfigurationWrapper.java 1 1 100.00%

@puzpuzpuz
Copy link
Copy Markdown
Contributor Author

@ideoma thanks for the snappy review!

@bluestreak01 bluestreak01 merged commit 086db70 into master Oct 10, 2025
35 checks passed
@bluestreak01 bluestreak01 deleted the puzpuzpuz_mat_view_refresh_step_overflow branch October 10, 2025 14:41
puzpuzpuz added a commit that referenced this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Incorrect or unexpected behavior Materialized View

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overflow in materialized view refresh step calculation on large sample by interval

4 participants