Repository navigation
Conversation
…not be converted
Under accurateCastOrNull a Variant or Dynamic source converts member by
member. createWrapperIfCanConvert probes each member and returns no wrapper
for one it cannot convert, and the assemblers then insert the default of the
target for its rows. That default is a failure only when it is NULL. Since
a tuple asks its elements for a non-nullable element type and reads failures
from a nullable result, a rejected member fed a plain default into a non-NULL
tuple: accurateCastOrNull(tuple(materialize(toUInt16(3)::Variant(UInt16))),
'Nullable(Tuple(FixedString(2)))') returned ('\0\0') instead of NULL, and
accurateCastOrDefault ignored its default. The answer depended on the other
members: one converting into a Nullable column made the result Nullable and
the default NULL.
When asked to report failures to a type that cannot contain NULL, a rejected
member now fails its values instead: createToNullableColumnWrapper (the
existing "not supported under accurateCastOrNull" fallback) when the type can
be inside Nullable, so the tuple takes the NULLs; otherwise (Array, Map,
LowCardinality, AggregateFunction) the member converts its actual values
without reporting failures, as an array element does, so '[1]'::Variant(String)
gives [1] instead of [] and UInt16 to Array(UInt8) throws TYPE_MISMATCH as
accurateCast does. An empty member is not converted. Top-level casts, Nullable
element targets and non-accurateOrNull casts are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop two in-body comments that narrated the new branches; state the never-empty case of createWrapperIfCanConvert precisely in its header (fails every value, or converts strictly when the target cannot be inside Nullable). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding; bounded: 1 full pass + 1 fix round + 1 delta recheck).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261118-034700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261118-031300 |
|
Workflow [PR], commit [a8b59f2] Summary: ❌
AI ReviewSummaryReviewed #132576 at Consumers of the intermediate nullable results were traced through Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing commit See the job log for details. |
… member A Variant or Dynamic member that the probe rejects now converts its values strictly when the tuple element type cannot be inside Nullable. Those values include the ones hidden under a NULL tuple, so accurateCastOrNull(if(number = 0, NULL, tuple(materialize(toUInt16(3)::Variant(UInt16)))), 'Nullable(Tuple(Array(UInt8)))') threw TYPE_MISMATCH instead of returning NULL, and a block mixing such a row with a convertible one failed as a whole. prepareRemoveNullable already converts only the rows that are not NULL under accurateCast. Do the same under accurateCastOrNull when the source type holds a Variant or Dynamic, both for a Nullable result and for a tuple element asked to report failures (a NULL tuple nested in a tuple), through one helper. Ordinary tuples still convert every row, so they pay no filtering cost. Reported in ClickHouse#132576 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - a8b59f2Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The other CIDB Session id: cron:our-pr-ci-monitor:20261118-110017 |
Take the NULL-row filter helper `convertNotNullRows`, the position of the `exclude_source_nulls` predicate and both call sites unchanged from ClickHouse#132576, so the two PRs share one helper and differ only in the predicate. The helper now returns the expanded column; the nullable-result branch wraps it with the source null map, and the report-failures-as-NULL branch hands it to the existing `wrapInNullable` tail, which merges the same map. No behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #132543
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
accurateCastOrNullandaccurateCastOrDefaultto aTuplewhose element is aVariantorDynamicvalue that cannot be converted to the element type: the result is nowNULL(or the given default) instead of a tuple holding the default of the element type. For anArray,MaporLowCardinalityelement such a value now converts as withaccurateCast.Description
On 26.10.3.7,
accurateCastOrNull(tuple(materialize(toUInt16(3)::Variant(UInt16))), 'Nullable(Tuple(FixedString(2)))')returns('\0\0')instead of NULL, andaccurateCastOrDefaultreturns it instead of its default. The same happens withDynamicand for nested or numeric tuple elements. Raised in the review of #132543 (thread); it predates #119183, so there is nothing to revert.A
VariantorDynamicsource converts member by member.createWrapperIfCanConvertreturned no conversion for a member it cannot convert, and the caller inserted the default of the target for its rows. That is a failure only when the default is NULL, but a tuple asks its elements for the non-nullable element type and reads failures from aNullableresult, so the default ended up in a non-NULL tuple. The result depended on the other members:Variant(UInt16, String)already gave NULL.When asked to report failures to a type without NULL, such a member now fails its values: through the existing all-NULL "not supported" conversion when the type can be inside
Nullable, otherwise (Array,Map,LowCardinality) by converting its values as an array element does.Behavior change: for an
Array,MaporLowCardinalityelement such a member now acts asaccurateCast(toUInt16(3)throwsTYPE_MISMATCH,'[1]'::Variant(String)gives([1])instead of([]), and the values under aNULLtuple are not converted). A member rejected although its values convert (a number to anEnumwithout 0, an array toQBit) now gives NULL here, as the top-level cast already does; #132256 fixes theEnumpart.The new test fails on master and passes with the fix; existing
accurateCast*,Variant/Dynamiccast,Nullable(Tuple)andQBittests pass unchanged.Workflow [PR]
Sync PR [sync-upstream/pr/132576]