Repository navigation
Fix FutureSet identity mismatch in TTLDeleteFilterStep - #98946
Merged
Merged
Conversation
`TTLDeleteFilterStep::transformPipeline` was creating new `TTLDeleteFilterTransform` instances via `addSimpleTransform`, each of which called `buildTTLExpressions` and produced new `FutureSetFromSubquery` objects. These were different from the ones filled by `CreatingSetStep`, causing a "Not-ready Set" exception when the TTL WHERE expression contained a subquery (e.g. `WHERE col IN (SELECT ...)`). Fix by following the same pattern as `TTLStep`: create a single `TTLDeleteFilterTransform` in the constructor, store it, and reuse it in `transformPipeline` via `addTransform`. This ensures the `FutureSet` objects are shared between `CreatingSetStep` and execution. Fixes #98614, #98692, #98814. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [73bddd2] Summary: ❌
|
- Move the min-TTL gate from transform time into `build`: entries whose `old_ttl_info.min` hasn't expired (and `force` is false) are now skipped before calling `buildTTLExpressions`, avoiding unnecessary DAG construction and `FutureSet` subqueries that would never be consumed. WHERE TTL entries are also skipped when `all_data_dropped` is already set. - Replace the two member methods `isTTLExpired` and `isMinTTLExpired` with a single static free function `isTTLExpired(ttl, current_time)` used in both `build` (for the min-TTL gate) and `transform` (for per-row checks). - Remove `force` and `old_ttl_info` from `SharedState` / `Entry` — they are now consumed entirely at build time. - Capture `shared_state` by value (`[state = shared_state]`) instead of by reference in the `transformPipeline` lambda in `TTLDeleteFilterStep`. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Member
Author
|
The diff became too big for me to quickly verify. I will do it at some point but @CurtizJ and @murphy-4o if you think this is just complete trash feel free to close this PR. At least the test is legit, it reproduces the issue. |
…count `rows_read` is updated from pipeline progress and may include auxiliary reads such as `CreatingSetStep` subqueries. Use `total_rows_count` to get the exact number of rows from source parts only. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add extra columns and deterministic merge settings to ensure the test reliably triggers the Vertical algorithm. Query `part_log` to assert the merge used Vertical and produced the expected row count. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Member
Author
|
Changes make sense to me |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| /// has already been called by createMergedStream(), so subqueries must be available now. | ||
| TTLDeleteFilterTransform probe(context, input_header_, metadata_snapshot, old_ttl_infos, current_time, force, data_part); | ||
| subqueries_for_sets = probe.getSubqueries(); | ||
| /// Build TTL expressions once and share them across all per-stream |
Member
There was a problem hiding this comment.
That's reasonable. LGTM.
alexey-milovidov
approved these changes
Mar 8, 2026
Contributor
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 97.75% (87/89) |
This was referenced Jun 30, 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.
Summary
TTLDeleteFilterStep::transformPipelinecreated newTTLDeleteFilterTransforminstances viaaddSimpleTransform, each rebuilding TTL expressions with newFutureSetFromSubqueryobjects. These differed from the ones filled byCreatingSetStep, causing a "Not-ready Set" exception when the TTL WHERE expression contained a subquery (e.g.WHERE col IN (SELECT ...)).TTLStep: create a singleTTLDeleteFilterTransformin the constructor, store it, and reuse it intransformPipelineviaaddTransform.Fixes #98614, Fixes #98692, Fixes #98814.
Test plan
04029_ttl_delete_filter_vertical_merge_subquerypasses with the fixChangelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
🤖 Generated with Claude Code
Note
Medium Risk
Touches vertical-merge TTL delete filtering and merge row-count bookkeeping; issues could surface as incorrect row filtering or merge progress/accounting when TTL WHERE uses subqueries.
Overview
Fixes vertical-merge TTL delete filtering when TTL
WHEREcontains subqueries by building TTL expressions once and sharing them via a newTTLDeleteFilterTransform::SharedState, ensuringCreatingSetStepfills the sameFutureSetinstances used at execution.Refactors
TTLDeleteFilterTransformto be a pure filter producer (removes per-part TTL-info mutation/finalization) and updatesTTLDeleteFilterStepconstruction accordingly.Adjusts vertical merge row counting to use
total_rows_count(instead of progress-drivenrows_read) and adds a regression test04029_ttl_delete_filter_vertical_merge_subquerycovering TTL delete + subquery during vertical merge.Written by Cursor Bugbot for commit 73bddd2. This will update automatically on new commits. Configure here.
Version info
26.3.1.512