Skip to content

Cherry pick #112338 to 26.3: Fix a crash when reading a nullable subcolumn of a Variant or Dynamic column - #119800

Merged
robot-ch-test-poll2 merged 8 commits into
backport/26.3/112338from
cherrypick/26.3/112338
Sep 14, 2026
Merged

robot-ch-test-poll2 merged 8 commits into
backport/26.3/112338from
cherrypick/26.3/112338

Conversation

@robot-ch-test-poll

Copy link
Copy Markdown
Contributor

Original pull-request #112338

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

groeneai and others added 7 commits July 28, 2026 12:51
… column

Reading a subcolumn whose own type is Nullable or LowCardinality(Nullable) out
of a Variant, Dynamic or JSON column stored in a MergeTree table crashed the
server. Three lines of plain SQL with default settings are enough:

    CREATE TABLE m (id UInt64, value Dynamic) ENGINE = MergeTree ORDER BY id;
    INSERT INTO m VALUES (1, CAST(tuple(CAST(1, 'Nullable(UInt32)'), 's'),
                                 'Tuple(a Nullable(UInt32), b String)'));
    SELECT value.`Tuple(a Nullable(UInt32), b String)`.a FROM m;

On a debug build this is a LOGICAL_ERROR ("Bad cast from type
DB::DataTypeNumber<unsigned int> to DB::DataTypeNullable"); on a release build
assert_cast degrades to a plain static_cast, so it is a segfault. Reproduced on
26.7.2.26, 26.6.2.120, 26.5.6.78 and 26.3.17.78. The same query against
ENGINE = Memory returns the correct value.

SerializationVariantElement recurses into the serialization of the on-disk
element, and the extraction framework exposes such an element as Nullable(T)
even though it is stored non-nullable. To keep the type it hands down consistent
with that nested serialization, it stripped nullability unconditionally. That
strip cannot distinguish nullability added by the extraction from nullability
intrinsic to the requested subcolumn: for a Nullable tuple element the nested
serialization is a SerializationNullable, and the strip removes exactly the
nullability it requires.

Strip only when the extraction's wrap actually changed the type. The decision is
made where the wrap happens and passed down as an explicit flag, which is also
part of the serialization's pooling key so that two serializations differing only
in it cannot share a pooled instance.

Both methods that recurse into the nested serialization are gated: gating only
enumerateStreams would move the crash into deserializeBinaryBulkWithMultipleStreams
instead of removing it. On the gated deserialization path the element's own null
map is read by the nested serialization, and the NULLs of rows belonging to other
variants come from insertDefault/insertManyDefaults.

Dynamic computes the flag in DataTypeDynamic::getSubcolumnData against the type
before the wrap. Variant derives it inside VariantSubcolumnCreator::create, where
prev_type is the selected subcolumn's pre-wrap type; deciding it once per variant
alternative is not sufficient, because with
allow_nullable_tuple_in_extracted_subcolumns = 1 the alternative's own wrap does
change the type and the strip would still fire on the intrinsically nullable
element. The shared-variant branch keeps an unconditional strip: its column is
always Nullable over the shared variant type while its nested serialization is a
plain String serialization.

IDataType::getSubcolumnData now applies a creator to the serialization before the
type, matching ISerialization::createFromPath, so the Variant predicate sees a
pre-wrap prev_type on both read paths. This is a prerequisite of the fix and is
behaviour-neutral for every creator that ignores its prev_type argument.

No on-disk format change and no new or changed setting. Parts written before this
change are read correctly afterwards; before it they could not be read at all.
Three lines of the test read as coverage but would pass byte-identically with
the fix reverted, so the suite was weaker than the PR description.

The JSON coverage only requested a non-nullable typed path, whose nullability is
added by the extraction, i.e. the pre-existing always-correct path. A JSON object
value is decomposed into one dynamic path per leaf, so a nested tuple never
materialises as a single dynamic value and no untyped JSON path can carry the
bug. A typed path keeps its declared type intact, so a path declared as a Variant
whose alternative is the nullable-element tuple is the reachable route; it aborts
on unfixed master. The original non-nullable line is kept as a control.

The runner draws min_bytes_for_wide_part = 0 with about 30% probability, and only
the wide table pinned its part thresholds, so on such a run every table was wide
and the compact reader - the one whose stack produced the original report - was
not covered at all. All the other tables now pin compact thresholds explicitly,
so the split no longer depends on the draw.

The paired query meant to build both serializations in one pool requested a type
that was not an alternative of that column, so it silently took the shared
variant branch instead. An extra row makes the type a real alternative. The two
instances are still discriminated by their nested serialization, which no
reachable query can make agree, so the comment now says that rather than claiming
a pool collision the query cannot produce.

Co-Authored-By: Claude Fable 5 <[email protected]>
master rewrote SerializationVariantElement::deserializeBinaryBulkWithMultipleStreams
twice since the branch point ("Remove rows_offset from the deserialization API" and
"Deserialize columns into IColumn& to fix substreams-cache clone regression"): the
discriminators and variant columns no longer live in the deserialization state, and
the result column is an IColumn& instead of a ColumnPtr &.

Both guards this branch adds to that function are conditions on expressions master
rewrote, so master's body is kept and only the conditions carry the
nullable_added_by_extraction test:

* the null map fill and the descent into the nested column now guard master's
  isColumnNullable(result_column) / inner_column = &nullable_column.getNestedColumn();
* the LowCardinality(Nullable) strip now guards master's unconditional
  isColumnLowCardinalityNullable(*inner_column) on the fresh variant clone.

The hand resolution touches one file: the two conditions, removal of the enclosing
block master deleted, and one comment compressed from 5 lines to 3. enumerateStreams,
the getHash and create signatures, and VariantSubcolumnCreator::create merged
unchanged, as did the other five files.
Both conflicts came from master renaming the dynamic-subcolumn result structure
(`res->serialization`/`res->type` -> `res->data.*`, `dynamic_subcolumn_data` ->
`dynamic_subcolumn_info->data`). Resolved by keeping this branch's semantics in master's
spelling: the ordering in `DataTypeDynamic::getDynamicSubcolumnData` that computes
`nullable_added_by_extraction` across the type wrap, and the serialization-before-type
creator order in `IDataType::getSubcolumnData`. Master's own
`ISerialization::createFromPath` already applies the creator in that same order.

#116739 (`8f3f7df0d3150`) landed on master after this branch was last updated, adding
`wrapColumnForDeserialization` overrides to `SerializationVariantElement` and
`SerializationDynamicElement` that peel the result column's `Nullable` level whenever
`isColumnNullable`. This branch makes the matching unwrap in
`deserializeBinaryBulkWithMultipleStreams` conditional on `nullable_added_by_extraction`, so
the wrap was checked against that flag too. Gating it changes no observable behavior: for an
intrinsic `Nullable` the peel hands the nested column to a `SerializationNullable`, which
does not override `wrapColumnForDeserialization`, so rebuilding the `ColumnNullable` around
it reproduces the input layout. Measured on this tree, 04652, 04653 and 05045 all pass both
with the gate and without it. The overrides are therefore left byte-identical to master, and
only the comment that described the unwrap as unconditional is corrected.

Validation on the merged tree (debug, build id a395d5b3272a6dd9d33e1a4bf2ee5a9ab4766540):
04652, 04653 and master's own 05045 all pass. With the six `src/` files reverted to master
(build id ed053ed21015c958), 05045 still passes while 04652 and 04653 fail with
`Bad cast from type DB::DataTypeNumber<unsigned int> to DB::DataTypeNullable`, so the fix
this branch carries is still load-bearing and is not superseded by anything on master.

Co-Authored-By: Claude Opus 5 <[email protected]>
…-nullable-tuple-subcolumn

# Conflicts:
#	src/DataTypes/DataTypeDynamic.cpp
…-tuple-subcolumn

Fix a crash when reading a nullable subcolumn of a Variant or Dynamic column
@robot-ch-test-poll robot-ch-test-poll added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-critical-bugfix labels Sep 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

I resolved this cherry-pick's conflicts and validated the result on 26.3. Pushing to this branch needs write access I do not have, so the resolution itself is below.

The 14 conflicts across 6 files are all adaptations, not choices between sides. 26.3 predates master's SubcolumnInfo refactor, still has the (ColumnPtr & result_column, size_t rows_offset, ...) deserialize signature with the mutable_column idiom, and has no serialization pool at all. No master-side refactor rides along, and no prerequisite is imported: every symbol the fix adds already exists here.

Since ISerialization::pooled has zero matches in 26.3's src/, five hunks are deliberately dropped from the two element serializations, where an override of an absent virtual would not compile: getHash, static create, supportsPooling, allocatedBytes and wrapColumnForDeserialization. Nothing is lost: the fix's only change to the last one was three comment lines, and there is no pooling key to poison. nullable_added_by_extraction is threaded through the two public constructors instead, both trailing parameters mandatory, so a missed construction site is a compile error rather than a silent gap; all four construction sites tree-wide are in the three source files this touches, and each passes the flag.

The four test files apply as they are, except two comment lines in 04652 that described that pooling key and now describe only what the query exercises; that is the last hunk below, and it applies to the file as it merges in from master. Both .reference files stay byte-identical to master's.

Validated on the resolved tree (Debug, clang-21 per the pin at this ref): the three-line default-settings reproducer from #112338 segfaults on the official 26.3.33.73 build (rc=139, 3/3) and returns 1 after the port; 04652 and 04653 pass, 100 of 100 local runs with settings randomization on. Forcing the new flag to false, dropping either of the two gates, or flipping the shared-variant literal each brings the crash back, so the adaptation is load-bearing rather than cosmetic. 26.3's submodule pins are untouched.

To land it, merge the base into this branch and take the six source files from the diff below:

git checkout cherrypick/26.3/112338
git merge backport/26.3/112338
git checkout backport/26.3/112338 -- src/DataTypes/DataTypeDynamic.cpp src/DataTypes/IDataType.cpp src/DataTypes/Serializations/SerializationDynamicElement.cpp src/DataTypes/Serializations/SerializationDynamicElement.h src/DataTypes/Serializations/SerializationVariantElement.cpp src/DataTypes/Serializations/SerializationVariantElement.h
git apply --index resolution.diff
git commit --no-edit
git push origin HEAD:cherrypick/26.3/112338

git rev-parse HEAD^{tree} must then print d7e458b39636ab440e2a2135fe59518b34443df4, the tree I built and tested; resolving the six files by hand is equivalent as long as that hash matches. The push is a strict fast-forward of cherrypick/26.3/112338 and leaves the branch in the same two-parent shape the automation builds itself, so this PR stops conflicting and the chain continues on its own.

The resolution: six source files against backport/26.3/112338, plus the one comment hunk in 04652
diff --git a/src/DataTypes/DataTypeDynamic.cpp b/src/DataTypes/DataTypeDynamic.cpp
--- a/src/DataTypes/DataTypeDynamic.cpp
+++ b/src/DataTypes/DataTypeDynamic.cpp
@@ -244,17 +244,22 @@ std::unique_ptr<IDataType::SubstreamData> DataTypeDynamic::getDynamicSubcolumnDa
         }
     }
 
+    /// Make resulting subcolumn Nullable only if type subcolumn can be inside Nullable or can be LowCardinality(Nullable()).
+    bool make_subcolumn_nullable = canExtractedSubcolumnsBeInsideNullableOrLowCardinalityNullable(subcolumn_type);
+    auto subcolumn_type_before_wrap = res->type;
+    if (!is_null_map_subcolumn && make_subcolumn_nullable)
+        res->type = makeNullableOrLowCardinalityNullableSafe(res->type);
+    /// res->serialization serializes the type before the wrap above, so it must know whether the
+    /// nullability it will be handed at read time is that wrapper or the requested type's own.
+    bool nullable_added_by_extraction
+        = !isNullableOrLowCardinalityNullable(subcolumn_type_before_wrap) && isNullableOrLowCardinalityNullable(res->type);
     res->serialization = std::make_shared<SerializationDynamicElement>(
         res->serialization,
         dynamic_serialization.createSerializationForType(ColumnDynamic::getSharedVariantDataType()),
         subcolumn_type->getName(),
         String(subcolumn_nested_name),
-        is_null_map_subcolumn);
-
-    /// Make resulting subcolumn Nullable only if type subcolumn can be inside Nullable or can be LowCardinality(Nullable()).
-    bool make_subcolumn_nullable = canExtractedSubcolumnsBeInsideNullableOrLowCardinalityNullable(subcolumn_type);
-    if (!is_null_map_subcolumn && make_subcolumn_nullable)
-        res->type = makeNullableOrLowCardinalityNullableSafe(res->type);
+        is_null_map_subcolumn,
+        nullable_added_by_extraction);
 
     if (data.column)
     {
diff --git a/src/DataTypes/IDataType.cpp b/src/DataTypes/IDataType.cpp
--- a/src/DataTypes/IDataType.cpp
+++ b/src/DataTypes/IDataType.cpp
@@ -199,9 +199,12 @@ std::unique_ptr<IDataType::SubstreamData> IDataType::getSubcolumnData(
                         auto tmp_subpath = subpath;
                         if (tmp_subpath[i].creator)
                         {
+                            /// Build the serialization before the type is wrapped, so that a creator
+                            /// inspecting its prev_type argument sees the type the serialization
+                            /// actually serializes. Same order as in ISerialization::createFromPath.
+                            dynamic_subcolumn_data->serialization = tmp_subpath[i].creator->create(dynamic_subcolumn_data->serialization, dynamic_subcolumn_data->type);
                             dynamic_subcolumn_data->type = tmp_subpath[i].creator->create(dynamic_subcolumn_data->type);
                             dynamic_subcolumn_data->column = tmp_subpath[i].creator->create(dynamic_subcolumn_data->column);
-                            dynamic_subcolumn_data->serialization = tmp_subpath[i].creator->create(dynamic_subcolumn_data->serialization, dynamic_subcolumn_data->type);
                         }
 
                         tmp_subpath[i].data = *dynamic_subcolumn_data;
diff --git a/src/DataTypes/Serializations/SerializationDynamicElement.cpp b/src/DataTypes/Serializations/SerializationDynamicElement.cpp
--- a/src/DataTypes/Serializations/SerializationDynamicElement.cpp
+++ b/src/DataTypes/Serializations/SerializationDynamicElement.cpp
@@ -19,7 +19,6 @@ namespace ErrorCodes
     extern const int NOT_IMPLEMENTED;
 }
 
-
 struct DeserializeBinaryBulkStateDynamicElement : public ISerialization::DeserializeBinaryBulkState
 {
     ISerialization::DeserializeBinaryBulkStatePtr structure_state;
@@ -101,7 +100,7 @@ void SerializationDynamicElement::deserializeBinaryBulkStatePrefix(
                 dynamic_element_name, *global_discr, variant_type.getVariants().size());
         else
             dynamic_element_state->variant_serialization = std::make_shared<SerializationVariantElement>(
-                nested_serialization, dynamic_element_name, *global_discr, variant_type.getVariants().size());
+                nested_serialization, dynamic_element_name, *global_discr, variant_type.getVariants().size(), nullable_added_by_extraction);
         dynamic_element_state->variant_serialization->deserializeBinaryBulkStatePrefix(settings, dynamic_element_state->variant_element_state, cache);
         dynamic_element_state->read_from_shared_variant = false;
         settings.path.pop_back();
@@ -112,11 +111,15 @@ void SerializationDynamicElement::deserializeBinaryBulkStatePrefix(
         auto shared_variant_global_discr = variant_type.tryGetVariantDiscriminator(ColumnDynamic::getSharedVariantTypeName());
         chassert(shared_variant_global_discr.has_value());
         settings.path.push_back(Substream::DynamicData);
+        /// The shared variant is always read into a Nullable column of the shared variant type
+        /// (see below), while shared_variant_serialization is a plain String serialization, so the
+        /// Nullable is always added here and must always be removed - never forward the flag.
         dynamic_element_state->variant_serialization = std::make_shared<SerializationVariantElement>(
             shared_variant_serialization,
             ColumnDynamic::getSharedVariantTypeName(),
             *shared_variant_global_discr,
-            variant_type.getVariants().size());
+            variant_type.getVariants().size(),
+            /*nullable_added_by_extraction_=*/true);
         dynamic_element_state->variant_serialization->deserializeBinaryBulkStatePrefix(settings, dynamic_element_state->variant_element_state, cache);
         dynamic_element_state->read_from_shared_variant = true;
         settings.path.pop_back();
diff --git a/src/DataTypes/Serializations/SerializationDynamicElement.h b/src/DataTypes/Serializations/SerializationDynamicElement.h
--- a/src/DataTypes/Serializations/SerializationDynamicElement.h
+++ b/src/DataTypes/Serializations/SerializationDynamicElement.h
@@ -20,10 +20,14 @@ private:
     /// Needed to extract nested subcolumn from values in shared variant.
     String nested_subcolumn;
     bool is_null_map_subcolumn;
+    /// True when the extraction wrapped the requested subcolumn into Nullable or
+    /// LowCardinality(Nullable). Only forwarded to the variant element serialization of the requested
+    /// type; see SerializationVariantElement::nullable_added_by_extraction.
+    bool nullable_added_by_extraction;
 
 public:
-    SerializationDynamicElement(const SerializationPtr & nested_, const SerializationPtr & shared_variant_serialization_, const String & dynamic_element_name_, const String & nested_subcolumn_, bool is_null_map_subcolumn_ = false)
-        : SerializationWrapper(nested_), shared_variant_serialization(shared_variant_serialization_), dynamic_element_name(dynamic_element_name_), nested_subcolumn(nested_subcolumn_), is_null_map_subcolumn(is_null_map_subcolumn_)
+    SerializationDynamicElement(const SerializationPtr & nested_, const SerializationPtr & shared_variant_serialization_, const String & dynamic_element_name_, const String & nested_subcolumn_, bool is_null_map_subcolumn_, bool nullable_added_by_extraction_)
+        : SerializationWrapper(nested_), shared_variant_serialization(shared_variant_serialization_), dynamic_element_name(dynamic_element_name_), nested_subcolumn(nested_subcolumn_), is_null_map_subcolumn(is_null_map_subcolumn_), nullable_added_by_extraction(nullable_added_by_extraction_)
     {
     }
 
diff --git a/src/DataTypes/Serializations/SerializationVariantElement.cpp b/src/DataTypes/Serializations/SerializationVariantElement.cpp
--- a/src/DataTypes/Serializations/SerializationVariantElement.cpp
+++ b/src/DataTypes/Serializations/SerializationVariantElement.cpp
@@ -58,9 +58,18 @@ void SerializationVariantElement::enumerateStreams(
 
     const auto * deserialize_state = data.deserialize_state ? checkAndGetState<DeserializeBinaryBulkStateVariantElement>(data.deserialize_state) : nullptr;
     addVariantToPath(settings.path);
+    /// Remove the nullability only when the extraction added it. If the requested type is
+    /// intrinsically nullable, nested_serialization is a Nullable serialization and requires it.
+    auto nested_type = data.type;
+    auto nested_column = data.column;
+    if (nullable_added_by_extraction)
+    {
+        nested_type = nested_type ? removeNullableOrLowCardinalityNullable(nested_type) : nullptr;
+        nested_column = nested_column ? removeNullableOrLowCardinalityNullable(nested_column) : nullptr;
+    }
     auto nested_data = SubstreamData(nested_serialization)
-                       .withType(data.type ? removeNullableOrLowCardinalityNullable(data.type) : nullptr)
-                       .withColumn(data.column ? removeNullableOrLowCardinalityNullable(data.column) : nullptr)
+                       .withType(nested_type)
+                       .withColumn(nested_column)
                        .withSerializationInfo(data.serialization_info)
                        .withDeserializeState(deserialize_state ? deserialize_state->variant_element_state : nullptr);
     settings.path.back().data = nested_data;
@@ -202,9 +211,11 @@ void SerializationVariantElement::deserializeBinaryBulkWithMultipleStreams(
 
     /// Now we know the rows_offset and limit for our variant and can deserialize it.
 
-    /// If result column is Nullable, fill null map and extract nested column.
+    /// A Nullable wrapper added by the extraction is unknown to nested_serialization, so its null map
+    /// is filled here from the discriminators. An intrinsic Nullable belongs to nested_serialization,
+    /// which reads the element's own null map; other variants' rows become NULL via insertDefault().
     MutableColumnPtr mutable_column = result_column->assumeMutable();
-    if (isColumnNullable(*mutable_column))
+    if (nullable_added_by_extraction && isColumnNullable(*mutable_column))
     {
         auto & nullable_column = assert_cast<ColumnNullable &>(*mutable_column);
         NullMap & null_map = nullable_column.getNullMapData();
@@ -234,9 +245,9 @@ void SerializationVariantElement::deserializeBinaryBulkWithMultipleStreams(
     {
         variant_element_state->variant = mutable_column->cloneEmpty();
 
-        /// When result column is LowCardinality(Nullable(T)) we should
-        /// remove Nullable from variant column before deserialization.
-        if (isColumnLowCardinalityNullable(*mutable_column))
+        /// When result column is LowCardinality(Nullable(T)) and the Nullable was added by the
+        /// extraction, we should remove it from variant column before deserialization.
+        if (nullable_added_by_extraction && isColumnLowCardinalityNullable(*mutable_column))
             assert_cast<ColumnLowCardinality &>(*variant_element_state->variant->assumeMutable()).nestedRemoveNullable();
     }
 
@@ -404,9 +415,12 @@ DataTypePtr SerializationVariantElement::VariantSubcolumnCreator::create(const D
     return make_nullable ? makeNullableOrLowCardinalityNullableSafe(prev) : prev;
 }
 
-SerializationPtr SerializationVariantElement::VariantSubcolumnCreator::create(const SerializationPtr & prev, const DataTypePtr &) const
+SerializationPtr SerializationVariantElement::VariantSubcolumnCreator::create(const SerializationPtr & prev, const DataTypePtr & prev_type) const
 {
-    return std::make_shared<SerializationVariantElement>(prev, variant_element_name, global_variant_discriminator, num_variants);
+    /// prev_type is the type prev serializes, i.e. the requested subcolumn before create(prev_type)
+    /// wraps it. The wrap only adds nullability when the type does not have it already.
+    const bool nullable_added = make_nullable && prev_type && !isNullableOrLowCardinalityNullable(prev_type);
+    return std::make_shared<SerializationVariantElement>(prev, variant_element_name, global_variant_discriminator, num_variants, nullable_added);
 }
 
 ColumnPtr SerializationVariantElement::VariantSubcolumnCreator::create(const DB::ColumnPtr & prev) const
diff --git a/src/DataTypes/Serializations/SerializationVariantElement.h b/src/DataTypes/Serializations/SerializationVariantElement.h
--- a/src/DataTypes/Serializations/SerializationVariantElement.h
+++ b/src/DataTypes/Serializations/SerializationVariantElement.h
@@ -22,17 +22,24 @@ private:
     /// Total number of variants in the Variant type; used for bounds-checking
     /// compact discriminators read from the wire.
     size_t num_variants;
+    /// True when the requested subcolumn was wrapped into Nullable or LowCardinality(Nullable) by
+    /// the extraction framework: that wrapper is not part of what nested_serialization serializes,
+    /// so it must be removed before recursing into it. False when the requested type is
+    /// intrinsically nullable, in which case nested_serialization requires that nullability.
+    bool nullable_added_by_extraction;
 
 public:
     SerializationVariantElement(
         const SerializationPtr & nested_,
         const String & variant_element_name_,
         ColumnVariant::Discriminator variant_discriminator_,
-        size_t num_variants_)
+        size_t num_variants_,
+        bool nullable_added_by_extraction_)
         : SerializationWrapper(nested_)
         , variant_element_name(variant_element_name_)
         , variant_discriminator(variant_discriminator_)
         , num_variants(num_variants_)
+        , nullable_added_by_extraction(nullable_added_by_extraction_)
     {
     }
 
diff --git a/tests/queries/0_stateless/04652_nullable_tuple_element_subcolumn_of_dynamic_variant.sql b/tests/queries/0_stateless/04652_nullable_tuple_element_subcolumn_of_dynamic_variant.sql
--- a/tests/queries/0_stateless/04652_nullable_tuple_element_subcolumn_of_dynamic_variant.sql
+++ b/tests/queries/0_stateless/04652_nullable_tuple_element_subcolumn_of_dynamic_variant.sql
@@ -80,9 +80,7 @@ SELECT toTypeName(value.`Tuple(a UInt32, b String)`.a), value.`Tuple(a UInt32, b
 SELECT value.`Tuple(a Array(Nullable(UInt32)))`.a FROM t_controls ORDER BY id;
 SELECT value.`Tuple(a Map(String, Nullable(UInt32)))`.a FROM t_controls ORDER BY id;
 -- Reads an intrinsically nullable and an extraction-wrapped subcolumn of the same column in one
--- query, so both serializations are built while the same serialization pool is alive. The two are
--- already discriminated by their nested serialization, so the flag in the pooling key is defence in
--- depth against a future nested-serialization change.
+-- query, so both serializations are built and used for the same read.
 SELECT value.UInt32, value.`Tuple(a Nullable(UInt32), b String)`.a FROM t_controls ORDER BY id;
 
 -- The shared variant branch always reads into a Nullable column, so its unwrap stays unconditional.

…ypick/26.3/112338

# Conflicts:
#	src/DataTypes/DataTypeDynamic.cpp
#	src/DataTypes/IDataType.cpp
#	src/DataTypes/Serializations/SerializationDynamicElement.cpp
#	src/DataTypes/Serializations/SerializationDynamicElement.h
#	src/DataTypes/Serializations/SerializationVariantElement.cpp
#	src/DataTypes/Serializations/SerializationVariantElement.h
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Applied your resolution as written: merged backport/26.3/112338 into this branch, took the six source files from the base, applied the diff from your comment, and committed. git rev-parse HEAD^{tree} prints d7e458b39636ab440e2a2135fe59518b34443df4, matching the tree you built and tested. The diff against the base is exactly the 10 files of #112338. Pushed as 516e548; the PR is now MERGEABLE, so the cherry-pick automation can continue. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants