Repository navigation
Backport #101793 to 26.3: Fix ALTER TABLE MODIFY TTL with DateTime causing data loss on 32-bit overflow - #119002
Conversation
…using data loss on 32-bit overflow
1bda686 to
3d0785b
Compare
|
Workflow [BackportPR], commit [e9ff248] Summary: ✅ |
`widenTemporalType` uses `DataTypeNullable`, `DataTypeTuple`, `DataTypeArray`, `DataTypeMap` and `removeLowCardinalityAndNullable`. Master's `TTLDescription.cpp` already includes those headers for other code, so the original PR did not add them and the backport did not carry them over. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
@groeneai can you fix the failing tests in this PR? |
|
Acknowledged. I measured all three failures at the current head
The cherry-picks carry an earlier revision of the
I cannot push to the robot branch, so I will follow up here with the exact patch for the missing part of the cherry-pick, plus what to do with the 26.3 leg of |
|
The three failures have three independent causes, and none of them is a defect of the cherry-pick. All three are fixable in the tests, and nothing needs to be deleted: 3 files, 4 statements. Only the Correction to my earlier comment. I said the cherry-picks carry an earlier revision of the
The durable alternative: Validated on a local 26.3 build at |
…ple)`
Three failures of this backport on 26.3, each from a prerequisite that
this branch does not have.
`04077_datetime32_overflow` case 12 (`MODIFY TTL ts + INTERVAL 1 DAY
DELETE WHERE toTypeName(ts) = 'DateTime'`):
Code: 47. DB::Exception: Missing columns: 'ts' while processing:
'toTypeName(ts) = 'DateTime'', required columns: 'ts', no source columns.
(UNKNOWN_IDENTIFIER)
A stored TTL is an AST plus the list of columns it needs, rebuilt on
every `INSERT`, every merge and every table load. Here that list came
from the *built* expression, so constant folding dropped columns the
AST still refers to. Take it from the syntax analysis instead, which
sees the AST before folding - the same adaptation already merged into
`26.7` as `96b9965489c4`, minus the `GROUP BY SET` call site, which
does not exist in this branch. The `master` origin is `f0bf4fce55ed`
("Keep a TTL expression rebuildable and loadable"); only its
`required_source_columns` half is taken, not the unrelated
`Variant` / `Dynamic` type-mismatch strictness.
`05019_ttl_tuple_datetime_overflow`:
Code: 10. DB::Exception: Not found column t.ts in block. There are only
columns: value, t: While executing TTL. (NOT_FOUND_COLUMN_IN_BLOCK)
A TTL expression over a subcolumn needs the block lookup to resolve
subcolumns. That is `fee8688d12fb` ("Fix TTL expressions with
subcolumns causing exception on INSERT and merge"), which is in 26.6
and 26.7 but not here. Its one-line change is applied in the shape
this branch's loop has.
`05024_ttl_nullable_tuple_datetime_overflow`:
Code: 115. DB::Exception: Setting enable_nullable_tuple_type is neither a
builtin setting nor started with the prefix 'SQL_' or 'custom_' registered
for user-defined settings. (UNKNOWN_SETTING)
`Nullable(Tuple(...))` is not a 26.3 type, so widening a temporal
element through a `Nullable` wrapper is unreachable here and there is
no prerequisite short of backporting the type. The test is deleted
rather than kept as a permanently failing one.
Original pull-request #101793
Cherry-pick pull-request #117984
This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.
The PR source
The PR is created in the CI job
Version info
26.3.33.77