Repository navigation
Conversation
…umns and nullIn
ALTER TABLE ... DELETE/UPDATE and lightweight DELETE affected different rows
than the identical SELECT matched when session_timezone was set: the mutation
kept a bare string literal, so the background mutation thread, which has no
session context, parsed it in the server timezone. Silent wrong-row deletion,
reproduced on released 26.8.10.6, 26.6.8.7 and 26.5.7.64.
rewriteDateTimeLiteralsWithTimezone missed the predicate in three ways:
- The parser folds a plain literal list into ONE ASTLiteral (String for
IN ('a'), Tuple for IN ('a','b'), Array for IN ['a']), while tryWrapInLiterals
accepted only an explicit tuple() function or an ASTExpressionList. The latter
is never an IN right-hand side at all, so the only shape ever caught was the
explicit tuple() spelling, which is why a test written against it passed while
the user-facing spelling was broken.
- getDateTimeColumnType was called with the full dotted identifier name and
looked it up by exact name, so t.time never resolved. Resolution now follows
the analyzer: whole name first, then this table's own name as a qualifier,
then its database and table, with the first reading that names a column or a
subcolumn deciding. It is subcolumn-aware on purpose: a dotted name that
resolves must keep its OWN type, or a Tuple(time DateTime('UTC')) element
would silently take the session timezone from a same-named top-level column.
- The local IN-operator name set listed 4 of the 8 real operators, so
nullIn(time, ...) was never dispatched. Replaced with the tree's own
functionIsInOrGlobalInOperator, which deletes the duplicated list rather than
extending it, and deliberately excludes the *IgnoreSet variants (they return
zero without reading the set, so rewriting their operand cannot fix a row).
A homogeneous folded list is rewritten as a single
CAST([...], 'Array(DateTime(tz))') rather than per element, which keeps the
stored command O(1) in the element count (+45 bytes at any N) and O(1) in query
tree nodes (the same max_expanded_ast_elements floor of 13 at N = 100, 3000 and
40000). Measured end to end on 1M rows with mutations_sync = 2, it also runs
below master's own wall time (0.68x to 0.92x for N up to 40000), because the set
is built once from typed DateTime values instead of reparsing N strings. Two
alternatives were measured and rejected: arrayMap over the literal array is not
folded to a constant set and cost 236x master at N = 20000, and a per-element
tuple() expansion is linear in query tree nodes, which trips
max_expanded_ast_elements for a large list. A mixed collection has no common
element type, so it keeps the per-element expansion; that is the only remaining
linear path, and it crosses the default limit near 142k elements with a loud
Code: 36 rather than silently.
The rewritten right-hand side would otherwise have lost mutation partition
pruning, including for mutations that are correct and prunable today (a
deployment whose session timezone equals its server timezone, or a
timezone-independent literal such as '946688400'). is_literal_enumeration
therefore accepts a CAST of recursively literal arguments, restricted to a
target type that resolves to Array(DateTime) or Array(DateTime64) with an
explicit timezone. A zone-less Array(DateTime) is still refused, because
DataTypeDateTime would resolve it against the executing server's timezone while
pruning is computed on the initiator, which is exactly the divergence this guard
exists to prevent. Gating the rewrite itself on session_timezone differing from
the server timezone would be unsound: the mutation may replay on a replica whose
server timezone differs, which is the whole premise of the feature.
A lambda binds its parameters as plain ASTIdentifier nodes, so inside its body a
name like `time` is the array element and not the column of that name. The
visitor therefore stops at a lambda and walks its body itself with the names it
binds recorded. When an identifier's first name part is one of those names, the
lookup is RESTRICTED to the plain column reading the rewrite already had, never
the qualifier or subcolumn readings this change adds, and the new folded-literal
branch declines such a name outright. Every shape therefore resolves exactly as
master does outside that branch, which is provable by inspection.
The restriction is owed in both directions. Vetoing the lookup outright, as an
earlier revision of this branch did, also suppressed the pre-existing explicit
tuple() branch, which has been in released builds since ac2d50f: the stored
command kept a bare literal, and over an Array(DateTime) a UTC server then deleted
the row the identical SELECT does not match, where master deleted the right one.
Conversely, letting the comparison arm pass no bound names at all let the new
subcolumn reading resolve a dotted name rooted at a parameter, so x.time in
arrayExists(x -> x.time = '...', arr) over an Array(Tuple(time String)) found the
storage subcolumn x.time, wrapped the literal in the session timezone, and broke
the mutation with NO_COMMON_TYPE where master left it alone.
The comparison arm keeps master's resolution for a bare bound name on purpose. A
bound parameter can itself be an unzoned DateTime, as in
arrayExists(time -> time = '...', arr) over an Array(DateTime), and then the
literal does need the wrap: withholding it stores a bare string whose meaning is
the executing server's timezone. That element type is not knowable at this level,
because a parameter's type comes positionally from the enclosing higher-order
function's array argument, so inferring it would mean enumerating which arguments
of every such function are arrays. Declining inside the new folded-literal branch
is the conservative choice for the same reason. Two shapes stay wrong either way
over an Array(String) element, both unchanged from master: compared with =, the
mutation fails with NO_COMMON_TYPE, and with IN tuple('...') it completes and
deletes nothing. Out of scope here.
The guard tests the FIRST name part, because
arrayExists(x -> x.y = '...', arr) binds x and a dotted name rooted at a bound
parameter is bound too; the scope is popped with resize rather than a fixed pop
count so that nesting and a parameter-less lambda are both correct. This is the
pattern MergeTreeData.cpp already uses for the same hazard in the pruning
analysis, deliberately so. The ASTAssignment overload needs no guard: an
assignment target is never inside a lambda body, since ParserAssignment takes a
non-compound ParserIdentifier.
04056_mutation_session_timezone_datetime_literals covers the affected shapes;
its fixtures each hold the two absolute instants the literal can denote, so
every assertion holds whatever timezone the server runs in, and the oracle is
that the mutation affects exactly the rows the identical SELECT matches.
04035_mutation_partition_pruning gains the pruning cases: a rewritten predicate
prunes to one partition, while a subquery right-hand side and a zone-less cast
still do not, and the same cast with an explicit timezone does. The lambda cases
assert that the row set matches the identical SELECT, that a shadowed literal
list leaves no timezone in the stored command, and that an unzoned DateTime
element still gets one. Two controls keep the guard honest: a real column named
in the same body IS still rewritten, so the guard cannot be satisfied by skipping
lambda bodies outright, and a scope-pop case over IN on both sides, which
regresses if the bound names leak past the lambda. Two further cases pin the
restriction itself: the explicit tuple() spelling over an Array(DateTime), which
must still be converted, and a dotted name rooted at a parameter over an
Array(Tuple(time String)), which must not be. The subcolumn case now uses a Tuple
column named after the table, so it is the qualifier-stripping fallback that would
reach the zone-less top-level column; with the subcolumn reading removed that case
deletes nothing and stores the session timezone, which the previous fixture could
not detect.
Closes: ClickHouse#121991
Co-Authored-By: Claude Opus 5 <[email protected]>
Delete new-code design narration; keep the AST, analyzer and type-system properties as standalone invariants.
Internal second-model review: adjudication log (4 passes, on
|
| N | master wall | this PR | ratio | stored command bytes |
|---|---|---|---|---|
| 100 | 0.172 s | 0.159 s | 0.92x | 2323 to 2368 (+45) |
| 1,000 | 0.187 s | 0.172 s | 0.92x | 23023 to 23068 (+45) |
| 20,000 | 0.509 s | 0.364 s | 0.72x | 460023 to 460068 (+45) |
| 40,000 | 0.847 s | 0.580 s | 0.68x | 920023 to 920068 (+45) |
1M-row MergeTree, mutations_sync = 2, predicate passed via --queries-file (at N = 20k the 460 KB
predicate exceeds the argv limit), two binaries with distinct Build-IDs. At N = 100 the two builds differ
by an id-sum of 2,520,000 = 100 rows x 25,200 s, exactly January's 7-hour Denver offset, so they delete
different rows rather than merely differing in speed. Node count is measured by binary-searching
max_expanded_ast_elements: the floor is 13 at N = 100, 3,000 and 40,000 for a homogeneous list, versus
about 3.50 nodes per element for the heterogeneous arm.
- A qualified name resolves subcolumn-first, which stops matching the analyzer under
analyzer_compatibility_prefer_alias_over_subcolumn = 1(disagreed, with the mechanism). The
divergence is real but it is not this rewrite's, and honouring the setting here would not repair it: a
mutation is re-analyzed in a context built from the background context and never from the submitting
query (MutatePlainMergeTreeTask::createTaskContext, thenContext::makeQueryContextForMutate, whose
own comment states as much), so the background binds the subcolumn whatever the literal carries, and a
literal wrapped for the top-level column would be compared against aDateTime('UTC')subcolumn. The
same divergence appears with noDateTimeand no literal anywhere, for instance
ALTER TABLE t DELETE WHERE t.x = 5overt Tuple(x UInt32)beside a top-levelx UInt32, which this
rewrite never touches. It is unchanged from master, and closing it needs the resolved identifier
serialized into the stored command, or the resolution-affecting settings carried with the mutation. I
am tracking that separately rather than widening this change.
💡 Nits (not blocking)
- A heterogeneous literal list loses the partition pruning master had for the folded form, since the
per-element expansion is not a form the pruning classifier accepts. Correctness is unaffected, because
all-partitions is the conservative direction, and a homogeneous list keeps pruning through the new
timezone-pinnedCAST. - Inside a lambda body the folded and
tuple(...)spellings of the same predicate diverge over an
Array(DateTime)column. Narrow, and not a regression, since master rewrote neither. No sound fix
exists at this level: the parameter's own type is not knowable here without inferring it positionally
from each higher-order function's array argument, and reusing the column type as a proxy is what makes
the comparison arm unsound forStringelements. - The
DateTime64arm of the pruning type check, and a foldedINover aNullableorLowCardinality
column, are reached by construction but not asserted. Both share their logic with asserted paths.
Checked and deliberately not raised
The changelog category was re-tested against all three conditions and stands as Bug Fix: released
26.8.10.6, 26.6.8.7 and 26.5.7.64 all delete the row the identical SELECT does not match.
session_timezone is a validated timezone setting, so building the target type cannot introduce a new
throw at ALTER time. The new spelling round-trips through the formatter and the parser, and the
replicated cases exercise that round trip rather than arguing it. The pruning guard's type check cannot
throw on hostile text, because DataTypeFactory::tryGet returns nullptr on a parse error.
InterpreterUpdateQuery and the two other DELETE branches need no rewrite: they interpret their
commands in the foreground with the submitting context, so the session timezone already applies. No test
in the suite changes behaviour under this diff: the only mutation predicate carrying an IN literal list
against a date-ish column has a Date column, which this rewrite does not touch.
Pre-PR validation gate (a-i)
Also: 50 randomized runs of the three affected tests (105 in total) gave 87 |
|
Workflow [PR], commit [c52c599] Summary: ❌
AI ReviewSummaryReviewed #122136 at Findings❌ Blockers
Missing context / blind spots
Final VerdictStatus: ❌ Block Fix the retained aliased numeric-string mismatch with a focused selected-versus-mutated-row regression, or link a dedicated tracking issue for the explicitly deferred behavior. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes6 object files changed (+92.65 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units9 translation units recompiled, 56 s compile time in total, 9 of them have a recent master baseline. |
…ation-in-literal-session-timezone
CI finish ledger - 84a154bEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Neither failure comes from this diff, which touches only mutation DateTime literal rewriting. Session id: cron:our-pr-ci-monitor:20260925-070026 |
CI finish ledger - 711ba8fEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Neither failure comes from this diff, which touches only mutation Session id: cron:our-pr-ci-monitor:20260925-123326 |
|
Fixing PR for the |
…ation-in-literal-session-timezone # Conflicts: # src/Storages/MergeTree/MergeTreeData.cpp
CI finish ledger - 12449ceEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The PR's own tests ( Session id: cron:our-pr-ci-monitor:20261009-180009 |
|
@groeneai merge master and check if failing tests are related with the changes |
Ergus
left a comment
There was a problem hiding this comment.
⚠️ The database-qualified offset (db.tbl.time, MutationsDateTimeLiteralVisitor.cpp:66) has no test. Smallest case: ALTER TABLE mut_tz_qual DELETE WHERE {CLICKHOUSE_DATABASE:Identifier}.mut_tz_qual.time = '2000-01-01 01:00:00'.⚠️ The per-element array(...) branch (a mixed Array literal, e.g. IN ['2000-01-01 01:00:00', NULL] on a Nullable(DateTime) column) has no test. Only the mixed Tuple branch is covered (in mixed, tokyo mixed).⚠️ Folded IN ('…', NULL) with a Nullable column has no test.⚠️ No globalIn/globalNotIn/notNullIn case exists; only nullIn is covered. These are reached through the same branch, so the risk is low.
…ation-in-literal-session-timezone
Review feedback on the session-timezone rewrite of mutation IN lists:
- A list mixing strings with numbers or NULL is rewritten element by element
into `toDateTime('...', 'tz')` / `toDateTime64('...', s, 'tz')` calls, which
the deferred-set guard of mutation partition pruning refused, so such
mutations touched every partition. The guard now also accepts those two
functions over literals when the timezone argument is a non-empty string
literal. An empty or missing timezone still refuses pruning, because it is
resolved by the reading host.
- `CAST` and `toDateTime` parse strings more leniently than the conversion an
IN set uses (`2000-01-01T01:00:00Z`, a trailing space, `2000-01-01 01:00`),
so an ALTER could be accepted where the identical SELECT is rejected. The
folded-list rewrite now first converts each string with the planner's own
set conversion (`getSetElementsForConstantValue`) and lets its error
propagate, so the ALTER fails with the same error as the SELECT. The
explicit `tuple(...)` spelling, whose strings were already wrapped in
`toDateTime`, gets the same check.
Tests: a database-qualified column, NULL in a folded tuple and array on a
Nullable column, GLOBAL IN / GLOBAL NOT IN / notNullIn, the rejected
strings, and a mixed list in the pruning test.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged master and pushed 5f112e2. The two failures on the previous head are not related to this change (neither test touches mutations or
The test gaps from the review are added to
The PR description is updated with these and the two fixes in the review threads. |
|
@groeneai Merge master and solve conflicts |
…ation-in-literal-session-timezone
|
Merged master ( I also resolved your two review threads from the last round, since both changes are in 5f112e2. Please reopen either one if something is still missing. |
| { | ||
| if (element.getType() != Field::Types::String) | ||
| continue; | ||
| checkConvertibleAsSetMember(element, zoned_type); |
There was a problem hiding this comment.
The strict check converts one string per call.
rewriteCollectionWithTimezone calls getSetElementsForConstantValue once per string element, each time building a DataTypeString, a size-1 const column and the full set-construction path.
For a homogeneous list this is N planner conversions whose results are discarded, followed by one more parse of the same strings by the emitted CAST at execution.
Perf claim (0.76–1.0x master up to N = 40 000) predates this commit, so the cost of the per-element path at large N is not measured.
Isn't it better to call over the whole string subset, passing an Array(String) const column and then fall back to the existing per-element shape only for the mixed case?
There was a problem hiding this comment.
Measured on release builds (CMAKE_BUILD_TYPE=None): ALTER TABLE t DELETE WHERE time IN (<N strings>) with session_timezone set, median server-side query_duration_ms, the four binaries interleaved:
| case | master | this PR | one call over Array(String) |
no strict check |
|---|---|---|---|---|
| N = 20,000, 1M rows (9 runs) | 349 ms | 268 ms | 298 ms | 229 ms |
| N = 40,000, 1M rows (9 runs) | 669 ms | 457 ms | 454 ms | 415 ms |
| N = 40,000, empty table (15 runs) | 472 ms | 345 ms | 347 ms | 282 ms |
The strict check costs 40-65 ms at N = 40,000, and a single call does not reduce it. getSetElementsForConstantValue batches only native numbers (nativeBatchApplicable, SetUtils.cpp:519), so an Array(String) against DateTime goes through membersFromArray (:709) and still converts one member at a time (:310), the same N conversions. So I kept the per-element call.
The per-element shape of a mixed list is the expensive part: 40,000 elements, half of them strings, take 1.85 s against 0.30 s on master (which reads the strings in the server timezone), and the check is 75 ms of that. Master's explicit tuple(...) spelling of the same list takes 3.3 s.
I updated the description to the release numbers: 0.68-1.0x master's wall time up to N = 40,000.
…ation-in-literal-session-timezone # Conflicts: # src/Interpreters/MutationsDateTimeLiteralVisitor.cpp
| if (strings == elements.size()) | ||
| return castCollectionWithTimezone(Array(elements.begin(), elements.end()), datetime_type, timezone); |
There was a problem hiding this comment.
[Blocker] Preserve the value produced by strict set conversion
An accepted string can produce different timestamps in set conversion and CAST. With the default cast_string_to_date_time_mode = 'best_effort', time IN ('20000101') treats the string as epoch seconds 20000101, but the emitted CAST(['20000101'], 'Array(DateTime(\'America/Denver\'))') treats it as a calendar date and produces epoch 946710000. The new validation succeeds and discards the correctly converted value.
For a table with time DateTime and rows at those two epochs, setting session_timezone = 'America/Denver' makes the original SELECT match the first row, while this rewrite makes ALTER ... DELETE delete the second row. Comparing the original and emitted expressions confirms the same mismatch for DateTime64(3) and for the per-element toDateTime form. This also regresses the formerly correct, timezone-independent numeric-string case.
Persist the values returned by strict set conversion, preserving their scale, so the stored command cannot reparse the original strings differently. Add a regression comparing the selected and deleted rows for this numeric string.
There was a problem hiding this comment.
Fixed in 1ccc3be: each string is now replaced by the value the IN set gives it (an epoch for DateTime, decimal seconds read as Decimal(38, S) for DateTime64), with in numeric* regressions in 04056 for both spellings.
There was a problem hiding this comment.
[Blocker] The latest alias fix reintroduces this issue at src/Interpreters/MutationsDateTimeLiteralVisitor.cpp:304-307: an aliased string takes wrapWithTimezone and bypasses convertAsSetMember.
For (id UInt8, time DateTime) with rows (1, 20000101) and (9, 946684800), set session_timezone = 'UTC' and use:
time IN tuple('20000101' AS lit) AND length(lit) = 8The original SELECT matches row 1, but the emitted time IN tuple(toDateTime('20000101' AS lit, 'UTC')) AND length(lit) = 8 matches row 9: the original numeric-string-to-calendar-date divergence is back. Confirmed by comparing these expressions on 26.10.3.7; the current source emits the latter shape. Please preserve both the alias's original string value and the strict set-conversion result, and add the numeric-string regression with an alias.
There was a problem hiding this comment.
Not changed here: master stores the same time IN tuple(toDateTime('20000101' AS lit, 'UTC')) and deletes the same row (measured on current master). Storing the set value instead would change what lit binds, so an aliased string keeps master's wrap; keeping both needs typed alias resolution, which is out of scope for this PR.
…ation
The rewrite validated each string of an `IN` list with the set conversion of
the identical `SELECT`, then discarded the result and stored a `CAST` of the
original strings. `CAST` and `toDateTime` read strings with
`cast_string_to_date_time_mode` (`best_effort` by default), which can give a
different instant than the set: `time IN ('20000101')` selects the epoch
20000101, but the stored `CAST(['20000101'], 'Array(DateTime(tz))')` reads
2000-01-01 00:00:00 in the session timezone, so the mutation deleted a
different row than the `SELECT` matched. On master that numeric string was
read correctly, since an epoch does not depend on the timezone.
Each string is now replaced by the value the set gives it in the session
timezone: the epoch for `DateTime`, and for `DateTime64` its decimal seconds
read back through `Decimal128(S)`. A `DateTime64` text reading would again
depend on the parsing mode, and loses the sign of an instant in the second
before 1970 (`'-0.500'` reads as +0.5).
Partition pruning admitted a cast to a zoned `DateTime` array and
`toDateTime(<literal>, '<tz>')` for the old spelling. With a string such as
`'Nov 24 12:00:00'` they are not stable: the missing year comes from the
current date, so the partitions recorded at submission can differ from the
rows the predicate matches when the mutation runs. Those arms are removed;
the rewritten `DateTime` list is a plain literal that already prunes, and
the `DateTime64` one is a literal cast to `Decimal`, which the guard now
admits because reading a decimal does not depend on the date or the server.
The explicit `tuple(...)` spelling, which master already wrapped in
`toDateTime`, takes the same set values, so its numeric strings are read
as the `SELECT` reads them too.
Tests: 04056 gains the numeric-string case for `DateTime` and
`DateTime64(3)` in both spellings, a `DateTime64` instant before 1970 and a
mixed `DateTime64` list; its rewrite oracles now look for the original string,
since a rewritten command no longer carries the timezone name. 04035 test
13b checks that the yearless cast and `toDateTime` keep every partition,
and test 15 that a rewritten `DateTime64` list still prunes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replacing a string of an IN list by its set value dropped an alias on
that string or on the list (`time IN ('...' AS tag) AND length(tag) = 1`
then read the `tag` column and deleted a row the identical SELECT does not
select, or failed with UNKNOWN_IDENTIFIER without such a column), and it
also took a name bound by an alias, such as `('...' AS time)`, for the
column of that name.
Such strings now get master's `toDateTime(..., tz)` wrap, which keeps the
alias on the literal, and a folded literal list is left as written, as on
master. Aliases are collected per scope as the analyzer does: a lambda
body adds its own while it is visited, and nothing inside a lambda or a
subquery is visible outside it. 04056 gains `in alias*` cases.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two names an alias binds were still taken for the stored column. With
`x Tuple(time String)`, `length((x.time AS time)) = 19 AND time NOT IN
('...')` was stored as `time NOT IN [<epoch>]` and deleted a row the
identical SELECT does not select: the collector skipped `x.time AS time`
as if it were `time AS time`. And an alias `x` shadowing a stored
`x Tuple(time DateTime)` made `x.time NOT IN ('...')` and `x.time = '...'`
read the stored subcolumn's type, because the alias check skipped
qualified names.
Only an identifier aliased to its own full name is now skipped, and the
check applies to the first part of a qualified name too, in comparisons as
well as in IN. Such a name gets exactly master's handling. An alias named
like the table therefore also keeps `tbl.time` at master's handling now:
whether the analyzer reads `tbl.time` through that alias depends on the
alias's type.
04056: the two shapes above as regressions, plus a `Tuple(time String)`
alias named like the table, which `tbl.time` does read; `in alias column`
keeps only the self-alias case.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #121991
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
ALTER TABLE ... DELETE,ALTER TABLE ... UPDATEand lightweightDELETEaffecting the wrong rows whensession_timezoneis set and the predicate compares aDateTimecolumn against a literal list (time IN ('...'),time IN ['...']), against a qualified name (tbl.time = '...'), or usesnullIn. Such a literal was parsed in the server timezone, so the mutation did not match the rows the identicalSELECTmatched.Description
On 26.8.10.6, with
session_timezone = 'America/Denver'and the server in UTC,ALTER TABLE t DELETE WHERE time IN ('2000-01-01 01:00:00')deletes the row the identicalSELECTdoes not match, and keeps the one it does.The rewrite that freezes the session timezone into the stored command had three holes:
String/Tuple/ArrayforIN ('a'),IN ('a','b'),IN ['a']), and the rewrite handled only the explicittuple(...)spelling;tbl.timenever resolved;INoperators, missingnullIn.Why these: a folded literal and an explicit
tuple(...)are the two spellings a literal list takes; a deferred set (subquery, table, table function) must not be rewritten. Three shapes, unchanged from master, stay out of scope: a function-wrapped column (toStartOfDay(time) = '...'); a constant-expression right-hand side (IN array('...')), where wrapping one element would makearray()seek a common element type; and a lambda parameter shadowing the column over aStringarray, in the bare=andIN tuple('...')spellings. The middle shape and that bare=errorNO_COMMON_TYPErather than deleting silently; theIN tuple('...')spelling completes and deletes nothing.Each unaliased string becomes the value the identical
SELECT'sINset gives it in the session timezone: an epoch forDateTime, decimal seconds read asDecimal(38, S)forDateTime64.CASTwould reread a stored string leniently ('2000-01-01T01:00:00Z', which the set rejects, so theALTERfails like theSELECT) or differently ('20000101': an epoch to the set, a date toCAST). Pruning admits a literal cast toDecimal, not aCAST/toDateTimeof a string (a yearless one reads the date). N = 40,000, release build:DateTime0.93x master's time,DateTime641.26x (1.0x at N = 1,000).Surface matrix: status and evidence
IN ('lit')/IN ('l1','l2')/IN ['lit'](folded)04056in one,in many,in arrayNOT IN,nullIn,GLOBAL [NOT] IN,notNullIn04056not in,null in,in operatorsIN ('lit', 946688400),IN ('lit', NULL),IN ['lit', NULL]04056in mixed,tokyo mixed,in nullIN ('20000101')04056in numeric*INset rejectsSELECT04056strictIN tuple('lit')05217,04056in numeric tupletbl.time = 'lit',tbl.time IN ('lit'),db.tbl.time = 'lit'04056*qualified*DateTime64(3), also before 1970 and mixed04056in dt64*ALTER ... UPDATE, lightweightDELETE04056in update,lightweightMergeTreeandReplicatedMergeTree04056/04035test 11Asia/Tokyo)04056tokyoIN []; aDateTime('UTC')column04056in empty,in explicitx.time/tbl.x.timetypedDateTime('UTC')04056sub*04056lambda *,in alias*UPDATE tbl.time = 'lit';has([...], time)Code: 62;NO_COMMON_TYPE, not silenttoStartOfDay(time) = 'lit';IN array('lit'); bare=vs. a shadowing parameterALTER=(#127982)Pruning: rewritten predicates prune (
04035tests 11, 14, 15); a subquery, a zone-lessCAST(..., 'Array(DateTime)')and yearlessCAST/toDateTimedefer (12, 13, 13b).Workflow [PR]
Sync PR [sync-upstream/pr/122136]