This is an automated email from the ASF dual-hosted git repository.

eldenmoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e3c5bb3fe6 [fix](variant) Recognize nullable array elements as 
NestedGroup types (#66196)
8e3c5bb3fe6 is described below

commit 8e3c5bb3fe63d1fdad16d0eea1edae71a70becd7
Author: lihangyu <[email protected]>
AuthorDate: Wed Jul 29 10:11:35 2026 +0800

    [fix](variant) Recognize nullable array elements as NestedGroup types 
(#66196)
    
    Related PR: #63088
    
    Problem Summary:
    
    Array elements are nullable after #63088. `get_base_type_of_array()`
    therefore returns `Nullable<Variant>` for the NestedGroup physical type,
    but `is_nested_group_type()` directly casts that wrapper to
    `DataTypeVariant`. The false negative bypasses the NestedGroup-specific
    type-conflict policy during Variant merge/compaction.
    
    This PR unwraps the nullable base type only when the input has an Array
    dimension. It recognizes `Array<Nullable<Variant>>` as NestedGroup while
    preserving the existing classifications of scalar `Variant` and
    `Nullable<Variant>`.
---
 be/src/core/column/column_variant.cpp       | 3 +++
 be/test/core/column/column_variant_test.cpp | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/be/src/core/column/column_variant.cpp 
b/be/src/core/column/column_variant.cpp
index aa910db7219..c1ae100bf47 100644
--- a/be/src/core/column/column_variant.cpp
+++ b/be/src/core/column/column_variant.cpp
@@ -142,6 +142,9 @@ size_t get_number_of_dimensions(const IDataType& type) {
 // which indicates NG-originated array<object> data.
 bool is_nested_group_type(const DataTypePtr& type) {
     auto base = get_base_type_of_array(type);
+    if (get_number_of_dimensions(*type) > 0) {
+        base = remove_nullable(base);
+    }
     return typeid_cast<const DataTypeVariant*>(base.get()) != nullptr;
 }
 
diff --git a/be/test/core/column/column_variant_test.cpp 
b/be/test/core/column/column_variant_test.cpp
index 24798accf9c..9494212fef5 100644
--- a/be/test/core/column/column_variant_test.cpp
+++ b/be/test/core/column/column_variant_test.cpp
@@ -3610,6 +3610,14 @@ TEST_F(ColumnVariantTest, subcolumn_finalize_and_insert) 
{
     array_subcolumn.finalize();
 }
 
+TEST(ColumnVariantNestedGroupTypeTest, nullable_array_element_is_recognized) {
+    EXPECT_TRUE(is_nested_group_type(ColumnVariant::NESTED_TYPE));
+
+    auto variant = std::make_shared<DataTypeVariant>(0, false);
+    EXPECT_TRUE(is_nested_group_type(variant));
+    EXPECT_FALSE(is_nested_group_type(make_nullable(variant)));
+}
+
 TEST_F(ColumnVariantTest, deserialize_mixed_array_elements) {
     ColumnVariant::Subcolumn subcolumn(0, true /* is_nullable */, false /* 
is_root */);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to