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

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 71e86457883 [4.1](column) remove IDataType get_default (#62582) 
(#63308)
71e86457883 is described below

commit 71e86457883c33ea8f59aeadba2f6de1e339ac4c
Author: Mryange <[email protected]>
AuthorDate: Wed May 20 15:18:01 2026 +0800

    [4.1](column) remove IDataType get_default (#62582) (#63308)
    
    ### What problem does this PR solve?
    
    https://github.com/apache/doris/pull/62582
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/core/column/column_variant.cpp              |  57 +---
 be/src/core/data_type/data_type.cpp                |   4 +-
 be/src/core/data_type/data_type.h                  |   5 -
 be/src/core/data_type/data_type_array.cpp          |   6 -
 be/src/core/data_type/data_type_array.h            |   1 -
 be/src/core/data_type/data_type_bitmap.h           |   4 -
 be/src/core/data_type/data_type_decimal.cpp        |   5 -
 be/src/core/data_type/data_type_decimal.h          |   2 -
 .../core/data_type/data_type_fixed_length_object.h |   2 -
 be/src/core/data_type/data_type_hll.h              |   4 -
 be/src/core/data_type/data_type_jsonb.cpp          |  11 -
 be/src/core/data_type/data_type_jsonb.h            |   2 -
 be/src/core/data_type/data_type_map.cpp            |  10 -
 be/src/core/data_type/data_type_map.h              |   1 -
 be/src/core/data_type/data_type_nothing.h          |   6 -
 be/src/core/data_type/data_type_nullable.cpp       |   4 -
 be/src/core/data_type/data_type_nullable.h         |   2 -
 be/src/core/data_type/data_type_number_base.cpp    |   5 -
 be/src/core/data_type/data_type_number_base.h      |   2 -
 be/src/core/data_type/data_type_quantilestate.h    |   4 -
 be/src/core/data_type/data_type_string.cpp         |   4 -
 be/src/core/data_type/data_type_string.h           |   2 -
 be/src/core/data_type/data_type_struct.cpp         |   9 -
 be/src/core/data_type/data_type_struct.h           |   2 -
 be/src/core/data_type/data_type_varbinary.cpp      |   4 -
 be/src/core/data_type/data_type_varbinary.h        |   2 -
 be/src/core/data_type/data_type_variant.h          |   1 -
 be/src/storage/partial_update_info.cpp             |   6 +-
 be/src/storage/tablet/base_tablet.cpp              |   4 +-
 be/test/core/column/column_variant_test.cpp        |  29 +-
 be/test/core/data_type/common_data_type_test.h     |   1 -
 be/test/core/data_type/data_type_array_test.cpp    |   6 +-
 .../core/data_type/data_type_datetime_v2_test.cpp  |  17 -
 be/test/core/data_type/data_type_decimal_test.cpp  |  14 -
 .../data_type/data_type_insert_default_test.cpp    | 348 +++++++++++++++++++++
 be/test/core/data_type/data_type_jsonb_test.cpp    |   6 -
 be/test/core/data_type/data_type_number_test.cpp   |   7 -
 be/test/core/data_type/data_type_string_test.cpp   |   2 -
 .../core/data_type/data_type_varbinary_test.cpp    |   7 -
 .../test_partial_update_complex_type.out           |   8 +-
 40 files changed, 376 insertions(+), 240 deletions(-)

diff --git a/be/src/core/column/column_variant.cpp 
b/be/src/core/column/column_variant.cpp
index 9938faada16..f85833b75c0 100644
--- a/be/src/core/column/column_variant.cpp
+++ b/be/src/core/column/column_variant.cpp
@@ -2620,64 +2620,29 @@ bool 
ColumnVariant::try_insert_many_defaults_from_nested(const Subcolumns::NodeP
     return true;
 }
 
-/// Visitor that keeps @num_dimensions_to_keep dimensions in arrays
-/// and replaces all scalars or nested arrays to @replacement at that level.
-class FieldVisitorReplaceScalars : public StaticVisitor<Field> {
-public:
-    FieldVisitorReplaceScalars(const Field& replacement_, size_t 
num_dimensions_to_keep_)
-            : replacement(replacement_), 
num_dimensions_to_keep(num_dimensions_to_keep_) {}
-
-    template <PrimitiveType T>
-    Field apply(const typename PrimitiveTypeTraits<T>::CppType& x) const {
-        if constexpr (T == TYPE_ARRAY) {
-            if (num_dimensions_to_keep == 0) {
-                return replacement;
-            }
-
-            const size_t size = x.size();
-            Array res(size);
-            for (size_t i = 0; i < size; ++i) {
-                res[i] = apply_visitor(
-                        FieldVisitorReplaceScalars(replacement, 
num_dimensions_to_keep - 1), x[i]);
-            }
-            return Field::create_field<TYPE_ARRAY>(res);
-        } else {
-            return replacement;
-        }
-    }
-
-private:
-    const Field& replacement;
-    size_t num_dimensions_to_keep;
-};
-
 bool ColumnVariant::try_insert_default_from_nested(const Subcolumns::NodePtr& 
entry) const {
     const auto* leaf = get_leaf_of_the_same_nested(entry);
     if (!leaf) {
         return false;
     }
 
-    auto last_field = leaf->data.get_last_field();
-    if (last_field.is_null()) {
+    size_t leaf_size = leaf->data.size();
+    if (leaf_size == 0) {
         return false;
     }
 
-    size_t leaf_num_dimensions = leaf->data.get_dimensions();
-    size_t entry_num_dimensions = entry->data.get_dimensions();
-
-    if (entry_num_dimensions > leaf_num_dimensions) {
-        throw doris::Exception(
-                ErrorCode::INVALID_ARGUMENT,
-                "entry_num_dimensions > leaf_num_dimensions, 
entry_num_dimensions={}, "
-                "leaf_num_dimensions={}",
-                entry_num_dimensions, leaf_num_dimensions);
+    if (leaf->data.is_null_at(leaf_size - 1)) {
+        return false;
     }
 
-    auto default_scalar = entry->data.get_least_common_type()->get_default();
+    FieldInfo field_info = {
+            .scalar_type_id = entry->data.least_common_type.get_base_type_id(),
+            .num_dimensions = entry->data.get_dimensions(),
+    };
 
-    auto default_field = apply_visitor(
-            FieldVisitorReplaceScalars(default_scalar, leaf_num_dimensions), 
last_field);
-    entry->data.insert(std::move(default_field));
+    auto new_subcolumn = leaf->data.cut(leaf_size - 1, 
1).clone_with_default_values(field_info);
+    entry->data.insert_range_from(new_subcolumn, 0, 1);
+    ENABLE_CHECK_CONSISTENCY(this);
     return true;
 }
 
diff --git a/be/src/core/data_type/data_type.cpp 
b/be/src/core/data_type/data_type.cpp
index e4c93e38dbb..60e5b6f2ee6 100644
--- a/be/src/core/data_type/data_type.cpp
+++ b/be/src/core/data_type/data_type.cpp
@@ -61,7 +61,9 @@ ColumnPtr IDataType::create_column_const(size_t size, const 
Field& field) const
 }
 
 ColumnPtr IDataType::create_column_const_with_default_value(size_t size) const 
{
-    return create_column_const(size, get_default());
+    auto column = create_column();
+    column->insert_default();
+    return ColumnConst::create(std::move(column), size);
 }
 
 size_t IDataType::get_size_of_value_in_memory() const {
diff --git a/be/src/core/data_type/data_type.h 
b/be/src/core/data_type/data_type.h
index e013fa206c9..8b62b1bb794 100644
--- a/be/src/core/data_type/data_type.h
+++ b/be/src/core/data_type/data_type.h
@@ -125,11 +125,6 @@ public:
     ColumnPtr create_column_const(size_t size, const Field& field) const;
     ColumnPtr create_column_const_with_default_value(size_t size) const;
 
-    /** Get default value of data type.
-      * It is the "default" default, regardless the fact that a table could 
contain different user-specified default.
-      */
-    virtual Field get_default() const = 0;
-
     virtual Field get_field(const TExprNode& node) const = 0;
 
     /// Checks that two instances belong to the same type
diff --git a/be/src/core/data_type/data_type_array.cpp 
b/be/src/core/data_type/data_type_array.cpp
index 851a98695b5..f1841f0e2dc 100644
--- a/be/src/core/data_type/data_type_array.cpp
+++ b/be/src/core/data_type/data_type_array.cpp
@@ -59,12 +59,6 @@ Status DataTypeArray::check_column(const IColumn& column) 
const {
     return nested->check_column(column_array->get_data());
 }
 
-Field DataTypeArray::get_default() const {
-    Array a;
-    a.push_back(nested->get_default());
-    return Field::create_field<TYPE_ARRAY>(a);
-}
-
 bool DataTypeArray::equals(const IDataType& rhs) const {
     return typeid(rhs) == typeid(*this) &&
            nested->equals(*static_cast<const DataTypeArray&>(rhs).nested);
diff --git a/be/src/core/data_type/data_type_array.h 
b/be/src/core/data_type/data_type_array.h
index d17743cd958..7579ad5cb26 100644
--- a/be/src/core/data_type/data_type_array.h
+++ b/be/src/core/data_type/data_type_array.h
@@ -67,7 +67,6 @@ public:
 
     MutableColumnPtr create_column() const override;
     Status check_column(const IColumn& column) const override;
-    Field get_default() const override;
 
     [[noreturn]] Field get_field(const TExprNode& node) const override {
         throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
diff --git a/be/src/core/data_type/data_type_bitmap.h 
b/be/src/core/data_type/data_type_bitmap.h
index 66fd0a8a114..c47e9b30a78 100644
--- a/be/src/core/data_type/data_type_bitmap.h
+++ b/be/src/core/data_type/data_type_bitmap.h
@@ -68,10 +68,6 @@ public:
 
     bool equals(const IDataType& rhs) const override { return typeid(rhs) == 
typeid(*this); }
 
-    Field get_default() const override {
-        return Field::create_field<TYPE_BITMAP>(BitmapValue::empty_bitmap());
-    }
-
     [[noreturn]] Field get_field(const TExprNode& node) const override {
         throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
                                "Unimplemented get_field for BitMap");
diff --git a/be/src/core/data_type/data_type_decimal.cpp 
b/be/src/core/data_type/data_type_decimal.cpp
index cfc06c83cee..eaf5ee95622 100644
--- a/be/src/core/data_type/data_type_decimal.cpp
+++ b/be/src/core/data_type/data_type_decimal.cpp
@@ -259,11 +259,6 @@ void DataTypeDecimal<T>::to_pb_column_meta(PColumnMeta* 
col_meta) const {
     }
 }
 
-template <PrimitiveType T>
-Field DataTypeDecimal<T>::get_default() const {
-    return Field::create_field<T>(typename PrimitiveTypeTraits<T>::CppType());
-}
-
 template <PrimitiveType T>
 MutableColumnPtr DataTypeDecimal<T>::create_column() const {
     return ColumnType::create(0, scale);
diff --git a/be/src/core/data_type/data_type_decimal.h 
b/be/src/core/data_type/data_type_decimal.h
index 5d75d4e2672..12b7605d964 100644
--- a/be/src/core/data_type/data_type_decimal.h
+++ b/be/src/core/data_type/data_type_decimal.h
@@ -184,8 +184,6 @@ public:
                             int be_exec_version) const override;
     void to_pb_column_meta(PColumnMeta* col_meta) const override;
 
-    Field get_default() const override;
-
     Field get_field(const TExprNode& node) const override {
         DCHECK_EQ(node.node_type, TExprNodeType::DECIMAL_LITERAL);
         DCHECK(node.__isset.decimal_literal);
diff --git a/be/src/core/data_type/data_type_fixed_length_object.h 
b/be/src/core/data_type/data_type_fixed_length_object.h
index fae94895ee0..d8ff996ab62 100644
--- a/be/src/core/data_type/data_type_fixed_length_object.h
+++ b/be/src/core/data_type/data_type_fixed_length_object.h
@@ -52,8 +52,6 @@ public:
         return doris::FieldType::OLAP_FIELD_TYPE_NONE;
     }
 
-    Field get_default() const override { return 
Field::create_field<TYPE_STRING>(String()); }
-
     [[noreturn]] Field get_field(const TExprNode& node) const override {
         throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
                                "Unimplemented get_field for 
DataTypeFixedLengthObject");
diff --git a/be/src/core/data_type/data_type_hll.h 
b/be/src/core/data_type/data_type_hll.h
index 0b111b2ff3f..3c4b632cc14 100644
--- a/be/src/core/data_type/data_type_hll.h
+++ b/be/src/core/data_type/data_type_hll.h
@@ -68,10 +68,6 @@ public:
 
     bool equals(const IDataType& rhs) const override { return typeid(rhs) == 
typeid(*this); }
 
-    Field get_default() const override {
-        return Field::create_field<TYPE_HLL>(HyperLogLog::empty());
-    }
-
     [[noreturn]] Field get_field(const TExprNode& node) const override {
         throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, 
"Unimplemented get_field for HLL");
     }
diff --git a/be/src/core/data_type/data_type_jsonb.cpp 
b/be/src/core/data_type/data_type_jsonb.cpp
index 416a4af11e0..dce379027d3 100644
--- a/be/src/core/data_type/data_type_jsonb.cpp
+++ b/be/src/core/data_type/data_type_jsonb.cpp
@@ -35,17 +35,6 @@ class IColumn;
 
 namespace doris {
 #include "common/compile_check_begin.h"
-Field DataTypeJsonb::get_default() const {
-    std::string default_json = "null";
-    // convert default_json to binary
-    JsonBinaryValue jsonb_value;
-    THROW_IF_ERROR(jsonb_value.from_json_string(default_json));
-    // Throw exception if default_json.size() is large than INT32_MAX
-    // JsonbField keeps its own memory
-    return Field::create_field<TYPE_JSONB>(
-            JsonbField(jsonb_value.value(), 
cast_set<Int32>(jsonb_value.size())));
-}
-
 Field DataTypeJsonb::get_field(const TExprNode& node) const {
     DCHECK_EQ(node.node_type, TExprNodeType::JSON_LITERAL);
     DCHECK(node.__isset.json_literal);
diff --git a/be/src/core/data_type/data_type_jsonb.h 
b/be/src/core/data_type/data_type_jsonb.h
index c11b5e077a9..c7fe0af35af 100644
--- a/be/src/core/data_type/data_type_jsonb.h
+++ b/be/src/core/data_type/data_type_jsonb.h
@@ -64,8 +64,6 @@ public:
     MutableColumnPtr create_column() const override;
     Status check_column(const IColumn& column) const override;
 
-    Field get_default() const override;
-
     Field get_field(const TExprNode& node) const override;
 
     FieldWithDataType get_field_with_data_type(const IColumn& column,
diff --git a/be/src/core/data_type/data_type_map.cpp 
b/be/src/core/data_type/data_type_map.cpp
index 9705811e85b..42581b1f93c 100644
--- a/be/src/core/data_type/data_type_map.cpp
+++ b/be/src/core/data_type/data_type_map.cpp
@@ -44,16 +44,6 @@ DataTypeMap::DataTypeMap(const DataTypePtr& key_type_, const 
DataTypePtr& value_
     value_type = value_type_;
 }
 
-Field DataTypeMap::get_default() const {
-    Map m;
-    Array key, val;
-    key.push_back(key_type->get_default());
-    val.push_back(value_type->get_default());
-    m.push_back(Field::create_field<TYPE_ARRAY>(key));
-    m.push_back(Field::create_field<TYPE_ARRAY>(val));
-    return Field::create_field<TYPE_MAP>(m);
-};
-
 MutableColumnPtr DataTypeMap::create_column() const {
     return ColumnMap::create(key_type->create_column(), 
value_type->create_column(),
                              ColumnArray::ColumnOffsets::create());
diff --git a/be/src/core/data_type/data_type_map.h 
b/be/src/core/data_type/data_type_map.h
index 2224eb0adcb..ccb155af330 100644
--- a/be/src/core/data_type/data_type_map.h
+++ b/be/src/core/data_type/data_type_map.h
@@ -67,7 +67,6 @@ public:
 
     MutableColumnPtr create_column() const override;
     Status check_column(const IColumn& column) const override;
-    Field get_default() const override;
 
     [[noreturn]] Field get_field(const TExprNode& node) const override {
         throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, 
"Unimplemented get_field for map");
diff --git a/be/src/core/data_type/data_type_nothing.h 
b/be/src/core/data_type/data_type_nothing.h
index e50c9c87a94..f73388c954c 100644
--- a/be/src/core/data_type/data_type_nothing.h
+++ b/be/src/core/data_type/data_type_nothing.h
@@ -70,12 +70,6 @@ public:
     const char* deserialize(const char* buf, MutableColumnPtr* column,
                             int be_exec_version) const override;
 
-    [[noreturn]] Field get_default() const override {
-        throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
-                               "Method get_default() is not implemented for 
data type {}.",
-                               get_name());
-    }
-
     [[noreturn]] Field get_field(const TExprNode& node) const override {
         throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
                                "Unimplemented get_field for Nothing");
diff --git a/be/src/core/data_type/data_type_nullable.cpp 
b/be/src/core/data_type/data_type_nullable.cpp
index dcf67afd2cf..b8310bfca93 100644
--- a/be/src/core/data_type/data_type_nullable.cpp
+++ b/be/src/core/data_type/data_type_nullable.cpp
@@ -207,10 +207,6 @@ Status DataTypeNullable::check_column(const IColumn& 
column) const {
     return 
nested_data_type->check_column(column_nullable->get_nested_column());
 }
 
-Field DataTypeNullable::get_default() const {
-    return Field();
-}
-
 bool DataTypeNullable::equals(const IDataType& rhs) const {
     return rhs.is_nullable() &&
            nested_data_type->equals(*static_cast<const 
DataTypeNullable&>(rhs).nested_data_type);
diff --git a/be/src/core/data_type/data_type_nullable.h 
b/be/src/core/data_type/data_type_nullable.h
index fbb653ba1a1..a506fb9fb56 100644
--- a/be/src/core/data_type/data_type_nullable.h
+++ b/be/src/core/data_type/data_type_nullable.h
@@ -73,8 +73,6 @@ public:
     MutableColumnPtr create_column() const override;
     Status check_column(const IColumn& column) const override;
 
-    Field get_default() const override;
-
     Field get_field(const TExprNode& node) const override {
         if (node.node_type == TExprNodeType::NULL_LITERAL) {
             return Field();
diff --git a/be/src/core/data_type/data_type_number_base.cpp 
b/be/src/core/data_type/data_type_number_base.cpp
index f2149bf29eb..1dd7a19591b 100644
--- a/be/src/core/data_type/data_type_number_base.cpp
+++ b/be/src/core/data_type/data_type_number_base.cpp
@@ -71,11 +71,6 @@ std::string DataTypeNumberBase<T>::to_string(
 }
 #endif
 
-template <PrimitiveType T>
-Field DataTypeNumberBase<T>::get_default() const {
-    return Field::create_field<T>(typename PrimitiveTypeTraits<T>::CppType());
-}
-
 template <PrimitiveType T>
 Field DataTypeNumberBase<T>::get_field(const TExprNode& node) const {
     if constexpr (T == TYPE_BOOLEAN) {
diff --git a/be/src/core/data_type/data_type_number_base.h 
b/be/src/core/data_type/data_type_number_base.h
index 6614f25930b..4b3fb37406c 100644
--- a/be/src/core/data_type/data_type_number_base.h
+++ b/be/src/core/data_type/data_type_number_base.h
@@ -120,8 +120,6 @@ public:
         throw Exception(Status::FatalError("__builtin_unreachable"));
     }
 
-    Field get_default() const override;
-
     Field get_field(const TExprNode& node) const override;
 
     int64_t get_uncompressed_serialized_bytes(const IColumn& column,
diff --git a/be/src/core/data_type/data_type_quantilestate.h 
b/be/src/core/data_type/data_type_quantilestate.h
index 210873642c8..370f9bcb7d4 100644
--- a/be/src/core/data_type/data_type_quantilestate.h
+++ b/be/src/core/data_type/data_type_quantilestate.h
@@ -64,10 +64,6 @@ public:
 
     bool equals(const IDataType& rhs) const override { return typeid(rhs) == 
typeid(*this); }
 
-    Field get_default() const override {
-        return Field::create_field<TYPE_QUANTILE_STATE>(QuantileState());
-    }
-
     [[noreturn]] Field get_field(const TExprNode& node) const override {
         throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
                                "Unimplemented get_field for quantile state");
diff --git a/be/src/core/data_type/data_type_string.cpp 
b/be/src/core/data_type/data_type_string.cpp
index 27866dd80f5..05dfb781486 100644
--- a/be/src/core/data_type/data_type_string.cpp
+++ b/be/src/core/data_type/data_type_string.cpp
@@ -44,10 +44,6 @@
 namespace doris {
 #include "common/compile_check_begin.h"
 
-Field DataTypeString::get_default() const {
-    return Field::create_field<TYPE_STRING>(String());
-}
-
 MutableColumnPtr DataTypeString::create_column() const {
     return ColumnString::create();
 }
diff --git a/be/src/core/data_type/data_type_string.h 
b/be/src/core/data_type/data_type_string.h
index 083c153dfb3..32385b7afb1 100644
--- a/be/src/core/data_type/data_type_string.h
+++ b/be/src/core/data_type/data_type_string.h
@@ -67,8 +67,6 @@ public:
     MutableColumnPtr create_column() const override;
     Status check_column(const IColumn& column) const override;
 
-    Field get_default() const override;
-
     Field get_field(const TExprNode& node) const override {
         DCHECK_EQ(node.node_type, TExprNodeType::STRING_LITERAL);
         DCHECK(node.__isset.string_literal);
diff --git a/be/src/core/data_type/data_type_struct.cpp 
b/be/src/core/data_type/data_type_struct.cpp
index 0c981481c69..d0b119e1c60 100644
--- a/be/src/core/data_type/data_type_struct.cpp
+++ b/be/src/core/data_type/data_type_struct.cpp
@@ -125,15 +125,6 @@ Status DataTypeStruct::check_column(const IColumn& column) 
const {
     return Status::OK();
 }
 
-Field DataTypeStruct::get_default() const {
-    size_t size = elems.size();
-    Tuple t;
-    for (size_t i = 0; i < size; ++i) {
-        t.push_back(elems[i]->get_default());
-    }
-    return Field::create_field<TYPE_STRUCT>(t);
-}
-
 bool DataTypeStruct::equals(const IDataType& rhs) const {
     if (typeid(rhs) != typeid(*this)) {
         return false;
diff --git a/be/src/core/data_type/data_type_struct.h 
b/be/src/core/data_type/data_type_struct.h
index 9f7d90667a7..657364efbca 100644
--- a/be/src/core/data_type/data_type_struct.h
+++ b/be/src/core/data_type/data_type_struct.h
@@ -81,8 +81,6 @@ public:
     MutableColumnPtr create_column() const override;
     Status check_column(const IColumn& column) const override;
 
-    Field get_default() const override;
-
     Field get_field(const TExprNode& node) const override {
         throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
                                "Unimplemented get_field for struct");
diff --git a/be/src/core/data_type/data_type_varbinary.cpp 
b/be/src/core/data_type/data_type_varbinary.cpp
index f4d51e8d081..0bf483b8bbc 100644
--- a/be/src/core/data_type/data_type_varbinary.cpp
+++ b/be/src/core/data_type/data_type_varbinary.cpp
@@ -42,10 +42,6 @@
 namespace doris {
 #include "common/compile_check_begin.h"
 
-Field DataTypeVarbinary::get_default() const {
-    return Field::create_field<TYPE_VARBINARY>(StringView());
-}
-
 MutableColumnPtr DataTypeVarbinary::create_column() const {
     return ColumnVarbinary::create();
 }
diff --git a/be/src/core/data_type/data_type_varbinary.h 
b/be/src/core/data_type/data_type_varbinary.h
index c987cb946c2..de50e59c8f8 100644
--- a/be/src/core/data_type/data_type_varbinary.h
+++ b/be/src/core/data_type/data_type_varbinary.h
@@ -66,8 +66,6 @@ public:
     MutableColumnPtr create_column() const override;
     Status check_column(const IColumn& column) const override;
 
-    Field get_default() const override;
-
     Field get_field(const TExprNode& node) const override {
         DCHECK_EQ(node.node_type, TExprNodeType::VARBINARY_LITERAL);
         DCHECK(node.__isset.varbinary_literal);
diff --git a/be/src/core/data_type/data_type_variant.h 
b/be/src/core/data_type/data_type_variant.h
index a55f43b82c3..f8ec3484d6b 100644
--- a/be/src/core/data_type/data_type_variant.h
+++ b/be/src/core/data_type/data_type_variant.h
@@ -73,7 +73,6 @@ public:
     char* serialize(const IColumn& column, char* buf, int be_exec_version) 
const override;
     const char* deserialize(const char* buf, MutableColumnPtr* column,
                             int be_exec_version) const override;
-    Field get_default() const override { return 
Field::create_field<TYPE_VARIANT>(VariantMap()); }
 
     Field get_field(const TExprNode& node) const override;
 
diff --git a/be/src/storage/partial_update_info.cpp 
b/be/src/storage/partial_update_info.cpp
index 33b55372a41..e1eaee711d1 100644
--- a/be/src/storage/partial_update_info.cpp
+++ b/be/src/storage/partial_update_info.cpp
@@ -449,7 +449,7 @@ Status FixedReadPlan::fill_missing_columns(
                     // If the control flow reaches this branch, the column 
neither has default value
                     // nor is nullable. It means that the row's delete sign is 
marked, and the value
                     // columns are useless and won't be read. So we can just 
put arbitary values in the cells
-                    
missing_col->insert(tablet_column.get_vec_type()->get_default());
+                    missing_col->insert_default();
                 }
             } else {
                 
missing_col->insert_from(*old_value_block.get_by_position(i).column,
@@ -619,7 +619,7 @@ static void fill_non_primary_key_cell_for_column_store(
                 // store the generated auto-increment value in fixed partial 
update
                 new_col->insert_from(cur_col, block_pos);
             } else {
-                new_col->insert(tablet_column.get_vec_type()->get_default());
+                new_col->insert_default();
             }
         } else {
             auto pos_in_old_block = read_index.at(cid).at(segment_pos);
@@ -725,7 +725,7 @@ static void fill_non_primary_key_cell_for_row_store(
                 // store the generated auto-increment value in fixed partial 
update
                 new_col->insert_from(cur_col, block_pos);
             } else {
-                new_col->insert(tablet_column.get_vec_type()->get_default());
+                new_col->insert_default();
             }
         } else {
             new_col->insert_from(old_value_col, pos_in_old_block);
diff --git a/be/src/storage/tablet/base_tablet.cpp 
b/be/src/storage/tablet/base_tablet.cpp
index a87e3a75656..fbdc5544044 100644
--- a/be/src/storage/tablet/base_tablet.cpp
+++ b/be/src/storage/tablet/base_tablet.cpp
@@ -1167,7 +1167,7 @@ Status BaseTablet::generate_new_block_for_partial_update(
                                 mutable_column.get())
                                 ->insert_default();
                     } else {
-                        
mutable_column->insert(rs_column.get_vec_type()->get_default());
+                        mutable_column->insert_default();
                     }
                 } else {
                     
mutable_column->insert_from(*old_block.get_by_position(i).column,
@@ -1219,7 +1219,7 @@ static void fill_cell_for_flexible_partial_update(
                 //       keep consistency between replicas
                 new_col->insert_from(cur_col, 
read_index_update[cast_set<uint32_t>(idx)]);
             } else {
-                new_col->insert(tablet_column.get_vec_type()->get_default());
+                new_col->insert_default();
             }
         } else {
             new_col->insert_from(old_value_col, 
read_index_old[cast_set<uint32_t>(idx)]);
diff --git a/be/test/core/column/column_variant_test.cpp 
b/be/test/core/column/column_variant_test.cpp
index 2c81fe1a107..45894ef30e1 100644
--- a/be/test/core/column/column_variant_test.cpp
+++ b/be/test/core/column/column_variant_test.cpp
@@ -1115,7 +1115,10 @@ TEST_F(ColumnVariantTest, clone_resized) {
         for (; i < clone_count; ++i) {
             // more than source size
             Field target_field;
-            Field source_field = 
column_variant->get_root_type()->get_default();
+            auto default_column = 
column_variant->get_root_type()->create_column();
+            default_column->insert_default();
+            Field source_field;
+            default_column->get(0, source_field);
             target_column->get(i, target_field);
             EXPECT_EQ(target_field, source_field)
                     << "target_field: " << target_field.get_type_name()
@@ -3082,30 +3085,6 @@ TEST_F(ColumnVariantTest, get_field_info_all_types) {
     }
 }
 
-TEST_F(ColumnVariantTest, field_visitor) {
-    // Test replacing scalar values in a flat array
-    {
-        Array array;
-        array.push_back(Field::create_field<TYPE_BIGINT>(Int64(1)));
-        array.push_back(Field::create_field<TYPE_BIGINT>(Int64(2)));
-        array.push_back(Field::create_field<TYPE_BIGINT>(Int64(3)));
-
-        Field field = Field::create_field<TYPE_ARRAY>(std::move(array));
-        Field replacement = Field::create_field<TYPE_BIGINT>(Int64(42));
-        Field result = apply_visitor(FieldVisitorReplaceScalars(replacement, 
0), field);
-
-        EXPECT_EQ(result.get<TYPE_BIGINT>(), 42);
-
-        Field replacement1 = Field::create_field<TYPE_BIGINT>(Int64(42));
-        Field result1 = apply_visitor(FieldVisitorReplaceScalars(replacement, 
1), field);
-
-        EXPECT_EQ(result1.get<TYPE_ARRAY>().size(), 3);
-        EXPECT_EQ(result1.get<TYPE_ARRAY>()[0].get<TYPE_BIGINT>(), 42);
-        EXPECT_EQ(result1.get<TYPE_ARRAY>()[1].get<TYPE_BIGINT>(), 42);
-        EXPECT_EQ(result1.get<TYPE_ARRAY>()[2].get<TYPE_BIGINT>(), 42);
-    }
-}
-
 TEST_F(ColumnVariantTest, subcolumn_operations_coverage) {
     // Test insert_range_from
     {
diff --git a/be/test/core/data_type/common_data_type_test.h 
b/be/test/core/data_type/common_data_type_test.h
index d70d5df5da7..869ab4c33a8 100644
--- a/be/test/core/data_type/common_data_type_test.h
+++ b/be/test/core/data_type/common_data_type_test.h
@@ -145,7 +145,6 @@ public:
             EXPECT_EQ(data_type->get_scale(), 0);
         }
         ASSERT_EQ(data_type->is_null_literal(), meta_info.is_null_literal);
-        ASSERT_EQ(data_type->get_default(), meta_info.default_field);
     }
 
     // create column assert with default field is simple and can be used for 
all DataType
diff --git a/be/test/core/data_type/data_type_array_test.cpp 
b/be/test/core/data_type/data_type_array_test.cpp
index 1613bba9d39..ebc6f3eedb8 100644
--- a/be/test/core/data_type/data_type_array_test.cpp
+++ b/be/test/core/data_type/data_type_array_test.cpp
@@ -333,14 +333,10 @@ protected:
 TEST_F(DataTypeArrayTest, MetaInfoTest) {
     for (auto& type : array_types) {
         const auto* array_type = assert_cast<const 
DataTypeArray*>(remove_nullable(type).get());
-        auto nested_type =
-                assert_cast<const 
DataTypeArray*>(remove_nullable(type).get())->get_nested_type();
 
         auto arr_type_descriptor = type;
         auto col_meta = std::make_shared<PColumnMeta>();
         array_type->to_pb_column_meta(col_meta.get());
-        Array a;
-        a.push_back(nested_type->get_default());
 
         DataTypeMetaInfo arr_meta_info_to_assert = {
                 .type_id = PrimitiveType::TYPE_ARRAY,
@@ -354,7 +350,7 @@ TEST_F(DataTypeArrayTest, MetaInfoTest) {
                 .scale = size_t(-1),
                 .is_null_literal = false,
                 .pColumnMeta = col_meta.get(),
-                .default_field = Field::create_field<TYPE_ARRAY>(a),
+                .default_field = Field::create_field<TYPE_ARRAY>(Array()),
         };
         DataTypePtr arr = remove_nullable(type);
         meta_info_assert(arr, arr_meta_info_to_assert);
diff --git a/be/test/core/data_type/data_type_datetime_v2_test.cpp 
b/be/test/core/data_type/data_type_datetime_v2_test.cpp
index 02ae8d458b2..5b29c52d95b 100644
--- a/be/test/core/data_type/data_type_datetime_v2_test.cpp
+++ b/be/test/core/data_type/data_type_datetime_v2_test.cpp
@@ -123,23 +123,6 @@ TEST_F(DataTypeDateTimeV2Test, simple_func_test) {
     EXPECT_THROW(DataTypeTimeV2(7), Exception);
 }
 
-TEST_F(DataTypeDateTimeV2Test, get_default) {
-    auto v = 0UL;
-    EXPECT_EQ(dt_datetime_v2_0.get_default(),
-              Field::create_field<TYPE_DATETIMEV2>(
-                      *(typename 
PrimitiveTypeTraits<TYPE_DATETIMEV2>::CppType*)&v));
-    EXPECT_EQ(dt_datetime_v2_5.get_default(),
-              Field::create_field<TYPE_DATETIMEV2>(
-                      *(typename 
PrimitiveTypeTraits<TYPE_DATETIMEV2>::CppType*)&v));
-    EXPECT_EQ(dt_datetime_v2_6.get_default(),
-              Field::create_field<TYPE_DATETIMEV2>(
-                      *(typename 
PrimitiveTypeTraits<TYPE_DATETIMEV2>::CppType*)&v));
-    EXPECT_EQ(dt_date_v2.get_default(),
-              Field::create_field<TYPE_DATEV2>(
-                      *(typename 
PrimitiveTypeTraits<TYPE_DATEV2>::CppType*)&v));
-    EXPECT_EQ(dt_time_v2_6.get_default(), 
Field::create_field<TYPE_TIMEV2>(0.0));
-}
-
 TEST_F(DataTypeDateTimeV2Test, get_field) {
     config::allow_zero_date = true;
     {
diff --git a/be/test/core/data_type/data_type_decimal_test.cpp 
b/be/test/core/data_type/data_type_decimal_test.cpp
index cef5eab6346..22af5daa256 100644
--- a/be/test/core/data_type/data_type_decimal_test.cpp
+++ b/be/test/core/data_type/data_type_decimal_test.cpp
@@ -488,20 +488,6 @@ TEST_F(DataTypeDecimalTest, to_pb_column_meta) {
     test_func(dt_decimal128v3_1, PGenericType::DECIMAL128I);
     test_func(dt_decimal256_1, PGenericType::DECIMAL256);
 }
-TEST_F(DataTypeDecimalTest, get_default) {
-    auto test_func = [](auto dt) {
-        using DataType = decltype(dt);
-        using ColumnType = typename DataType::ColumnType;
-        auto default_field = dt.get_default();
-        auto decimal_field = default_field.template get<DataType::PType>();
-        EXPECT_EQ(decimal_field, typename ColumnType::value_type());
-    };
-    test_func(dt_decimal32_1);
-    test_func(dt_decimal64_1);
-    test_func(dt_decimal128v2);
-    test_func(dt_decimal128v3_1);
-    test_func(dt_decimal256_1);
-}
 TEST_F(DataTypeDecimalTest, get_field) {
     TExprNode expr_node;
     expr_node.node_type = TExprNodeType::DECIMAL_LITERAL;
diff --git a/be/test/core/data_type/data_type_insert_default_test.cpp 
b/be/test/core/data_type/data_type_insert_default_test.cpp
new file mode 100644
index 00000000000..1a7928139de
--- /dev/null
+++ b/be/test/core/data_type/data_type_insert_default_test.cpp
@@ -0,0 +1,348 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest.h>
+
+#include <memory>
+#include <vector>
+
+#include "agent/be_exec_version_manager.h"
+#include "core/data_type/data_type_agg_state.h"
+#include "core/data_type/data_type_array.h"
+#include "core/data_type/data_type_factory.hpp"
+#include "core/data_type/data_type_fixed_length_object.h"
+#include "core/data_type/data_type_map.h"
+#include "core/data_type/data_type_nothing.h"
+#include "core/data_type/data_type_nullable.h"
+#include "core/data_type/data_type_struct.h"
+#include "core/data_type/data_type_varbinary.h"
+#include "core/data_type/data_type_variant.h"
+#include "core/field.h"
+#include "core/types.h"
+#include "core/value/timestamptz_value.h"
+#include "core/value/vdatetime_value.h"
+
+namespace doris {
+namespace {
+
+Field get_default_field(const DataTypePtr& data_type) {
+    auto column = data_type->create_column();
+    if (column->size() != 0) {
+        ADD_FAILURE() << "column should be empty before insert_default";
+        return Field();
+    }
+
+    column->insert_default();
+    if (column->size() != 1) {
+        ADD_FAILURE() << "column should contain one row after insert_default";
+        return Field();
+    }
+
+    Field actual;
+    column->get(0, actual);
+    return actual;
+}
+
+TEST(DataTypeInsertDefaultTest, AllTypeFamilies) {
+    auto make_simple_type = [](PrimitiveType type) {
+        return DataTypeFactory::instance().create_data_type(type, false);
+    };
+
+    auto int_type = make_simple_type(TYPE_INT);
+    auto nullable_int_type = std::make_shared<DataTypeNullable>(int_type);
+    auto nullable_string_type = 
std::make_shared<DataTypeNullable>(make_simple_type(TYPE_STRING));
+
+    {
+        SCOPED_TRACE("bool");
+        auto actual = get_default_field(make_simple_type(TYPE_BOOLEAN));
+        ASSERT_EQ(actual.get_type(), TYPE_BOOLEAN);
+        EXPECT_EQ(actual.get<TYPE_BOOLEAN>(), UInt8(0));
+    }
+
+    {
+        SCOPED_TRACE("tinyint");
+        auto actual = get_default_field(make_simple_type(TYPE_TINYINT));
+        ASSERT_EQ(actual.get_type(), TYPE_TINYINT);
+        EXPECT_EQ(actual.get<TYPE_TINYINT>(), Int8(0));
+    }
+
+    {
+        SCOPED_TRACE("smallint");
+        auto actual = get_default_field(make_simple_type(TYPE_SMALLINT));
+        ASSERT_EQ(actual.get_type(), TYPE_SMALLINT);
+        EXPECT_EQ(actual.get<TYPE_SMALLINT>(), Int16(0));
+    }
+
+    {
+        SCOPED_TRACE("int");
+        auto actual = get_default_field(make_simple_type(TYPE_INT));
+        ASSERT_EQ(actual.get_type(), TYPE_INT);
+        EXPECT_EQ(actual.get<TYPE_INT>(), Int32(0));
+    }
+
+    {
+        SCOPED_TRACE("bigint");
+        auto actual = get_default_field(make_simple_type(TYPE_BIGINT));
+        ASSERT_EQ(actual.get_type(), TYPE_BIGINT);
+        EXPECT_EQ(actual.get<TYPE_BIGINT>(), Int64(0));
+    }
+
+    {
+        SCOPED_TRACE("largeint");
+        auto actual = get_default_field(make_simple_type(TYPE_LARGEINT));
+        ASSERT_EQ(actual.get_type(), TYPE_LARGEINT);
+        EXPECT_EQ(actual.get<TYPE_LARGEINT>(), Int128(0));
+    }
+
+    {
+        SCOPED_TRACE("float");
+        auto actual = get_default_field(make_simple_type(TYPE_FLOAT));
+        ASSERT_EQ(actual.get_type(), TYPE_FLOAT);
+        EXPECT_EQ(actual.get<TYPE_FLOAT>(), Float32(0));
+    }
+
+    {
+        SCOPED_TRACE("double");
+        auto actual = get_default_field(make_simple_type(TYPE_DOUBLE));
+        ASSERT_EQ(actual.get_type(), TYPE_DOUBLE);
+        EXPECT_EQ(actual.get<TYPE_DOUBLE>(), Float64(0));
+    }
+
+    {
+        SCOPED_TRACE("decimalv2");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_DECIMALV2, 
false, 27, 9));
+        ASSERT_EQ(actual.get_type(), TYPE_DECIMALV2);
+        EXPECT_EQ(actual.get<TYPE_DECIMALV2>(), DecimalV2Value());
+    }
+
+    {
+        SCOPED_TRACE("decimal32");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_DECIMAL32, 
false, 9, 2));
+        ASSERT_EQ(actual.get_type(), TYPE_DECIMAL32);
+        EXPECT_EQ(actual.get<TYPE_DECIMAL32>(), Decimal32(0));
+    }
+
+    {
+        SCOPED_TRACE("decimal64");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_DECIMAL64, 
false, 18, 9));
+        ASSERT_EQ(actual.get_type(), TYPE_DECIMAL64);
+        EXPECT_EQ(actual.get<TYPE_DECIMAL64>(), Decimal64(0));
+    }
+
+    {
+        SCOPED_TRACE("decimal128");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_DECIMAL128I, 
false, 38, 18));
+        ASSERT_EQ(actual.get_type(), TYPE_DECIMAL128I);
+        EXPECT_EQ(actual.get<TYPE_DECIMAL128I>(), Decimal128V3(0));
+    }
+
+    {
+        SCOPED_TRACE("decimal256");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_DECIMAL256, 
false, 76, 18));
+        ASSERT_EQ(actual.get_type(), TYPE_DECIMAL256);
+        EXPECT_EQ(actual.get<TYPE_DECIMAL256>(), Decimal256(0));
+    }
+
+    {
+        SCOPED_TRACE("date");
+        auto actual = get_default_field(make_simple_type(TYPE_DATE));
+        ASSERT_EQ(actual.get_type(), TYPE_DATE);
+        EXPECT_EQ(actual.get<TYPE_DATE>(), VecDateTimeValue::DEFAULT_VALUE);
+    }
+
+    {
+        SCOPED_TRACE("datetime");
+        auto actual = get_default_field(make_simple_type(TYPE_DATETIME));
+        ASSERT_EQ(actual.get_type(), TYPE_DATETIME);
+        EXPECT_EQ(actual.get<TYPE_DATETIME>(), 
VecDateTimeValue::DEFAULT_VALUE);
+    }
+
+    {
+        SCOPED_TRACE("datev2");
+        auto actual = get_default_field(make_simple_type(TYPE_DATEV2));
+        ASSERT_EQ(actual.get_type(), TYPE_DATEV2);
+        EXPECT_EQ(actual.get<TYPE_DATEV2>(), 
DateV2Value<DateV2ValueType>::DEFAULT_VALUE);
+    }
+
+    {
+        SCOPED_TRACE("datetimev2");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_DATETIMEV2, 
false, 0, 6));
+        ASSERT_EQ(actual.get_type(), TYPE_DATETIMEV2);
+        EXPECT_EQ(actual.get<TYPE_DATETIMEV2>(), 
DateV2Value<DateTimeV2ValueType>::DEFAULT_VALUE);
+    }
+
+    {
+        SCOPED_TRACE("timev2");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_TIMEV2, 
false, 0, 6));
+        ASSERT_EQ(actual.get_type(), TYPE_TIMEV2);
+        EXPECT_EQ(actual.get<TYPE_TIMEV2>(), Float64(0));
+    }
+
+    {
+        SCOPED_TRACE("timestamptz");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_TIMESTAMPTZ, 
false, 0, 6));
+        ASSERT_EQ(actual.get_type(), TYPE_TIMESTAMPTZ);
+        EXPECT_EQ(actual.get<TYPE_TIMESTAMPTZ>(), 
TimestampTzValue::DEFAULT_VALUE);
+    }
+
+    {
+        SCOPED_TRACE("ipv4");
+        auto actual = get_default_field(make_simple_type(TYPE_IPV4));
+        ASSERT_EQ(actual.get_type(), TYPE_IPV4);
+        EXPECT_EQ(actual.get<TYPE_IPV4>(), IPv4(0));
+    }
+
+    {
+        SCOPED_TRACE("ipv6");
+        auto actual = get_default_field(make_simple_type(TYPE_IPV6));
+        ASSERT_EQ(actual.get_type(), TYPE_IPV6);
+        EXPECT_EQ(actual.get<TYPE_IPV6>(), IPv6(0));
+    }
+
+    {
+        SCOPED_TRACE("char");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_CHAR, false, 
8, 0));
+        ASSERT_EQ(actual.get_type(), TYPE_STRING);
+        EXPECT_EQ(actual.get<TYPE_STRING>(), String());
+    }
+
+    {
+        SCOPED_TRACE("varchar");
+        auto actual = get_default_field(
+                DataTypeFactory::instance().create_data_type(TYPE_VARCHAR, 
false, 32, 0));
+        ASSERT_EQ(actual.get_type(), TYPE_STRING);
+        EXPECT_EQ(actual.get<TYPE_STRING>(), String());
+    }
+
+    {
+        SCOPED_TRACE("string");
+        auto actual = get_default_field(make_simple_type(TYPE_STRING));
+        ASSERT_EQ(actual.get_type(), TYPE_STRING);
+        EXPECT_EQ(actual.get<TYPE_STRING>(), String());
+    }
+
+    {
+        SCOPED_TRACE("varbinary");
+        auto actual = get_default_field(std::make_shared<DataTypeVarbinary>());
+        ASSERT_EQ(actual.get_type(), TYPE_VARBINARY);
+        EXPECT_EQ(actual.get<TYPE_VARBINARY>(), StringView());
+    }
+
+    {
+        SCOPED_TRACE("jsonb");
+        auto actual = get_default_field(make_simple_type(TYPE_JSONB));
+        ASSERT_TRUE(actual.get_type() == TYPE_JSONB || 
is_string_type(actual.get_type()));
+        if (actual.get_type() == TYPE_JSONB) {
+            EXPECT_EQ(actual.get<TYPE_JSONB>().get_size(), 0);
+        } else {
+            EXPECT_TRUE(actual.get<TYPE_STRING>().empty());
+        }
+    }
+
+    {
+        SCOPED_TRACE("bitmap");
+        auto actual = get_default_field(make_simple_type(TYPE_BITMAP));
+        ASSERT_EQ(actual.get_type(), TYPE_BITMAP);
+        EXPECT_EQ(actual.get<TYPE_BITMAP>().cardinality(), 0);
+    }
+
+    {
+        SCOPED_TRACE("hll");
+        auto actual = get_default_field(make_simple_type(TYPE_HLL));
+        ASSERT_EQ(actual.get_type(), TYPE_HLL);
+        EXPECT_EQ(actual.get<TYPE_HLL>().estimate_cardinality(), 0);
+    }
+
+    {
+        SCOPED_TRACE("quantile_state");
+        auto actual = get_default_field(make_simple_type(TYPE_QUANTILE_STATE));
+        QuantileState empty_state;
+        ASSERT_EQ(actual.get_type(), TYPE_QUANTILE_STATE);
+        EXPECT_EQ(actual.get<TYPE_QUANTILE_STATE>().get_serialized_size(),
+                  empty_state.get_serialized_size());
+    }
+
+    {
+        SCOPED_TRACE("variant");
+        auto actual = get_default_field(std::make_shared<DataTypeVariant>());
+        ASSERT_EQ(actual.get_type(), TYPE_NULL);
+        EXPECT_TRUE(actual.is_null());
+    }
+
+    {
+        SCOPED_TRACE("nothing");
+        auto actual = get_default_field(std::make_shared<DataTypeNothing>());
+        ASSERT_EQ(actual.get_type(), TYPE_NULL);
+        EXPECT_TRUE(actual.is_null());
+    }
+
+    {
+        SCOPED_TRACE("nullable<int>");
+        auto actual = get_default_field(nullable_int_type);
+        ASSERT_EQ(actual.get_type(), TYPE_NULL);
+        EXPECT_TRUE(actual.is_null());
+    }
+
+    {
+        SCOPED_TRACE("array<nullable<int>>");
+        auto actual = 
get_default_field(std::make_shared<DataTypeArray>(nullable_int_type));
+        ASSERT_EQ(actual.get_type(), TYPE_ARRAY);
+        EXPECT_TRUE(actual.get<TYPE_ARRAY>().empty());
+    }
+
+    {
+        SCOPED_TRACE("map<nullable<string>,nullable<int>>");
+        auto actual = get_default_field(
+                std::make_shared<DataTypeMap>(nullable_string_type, 
nullable_int_type));
+        ASSERT_EQ(actual.get_type(), TYPE_MAP);
+        const auto& map = actual.get<TYPE_MAP>();
+        ASSERT_EQ(map.size(), 2);
+        EXPECT_TRUE(map[0].get<TYPE_ARRAY>().empty());
+        EXPECT_TRUE(map[1].get<TYPE_ARRAY>().empty());
+    }
+
+    {
+        SCOPED_TRACE("struct<nullable<int>,nullable<string>>");
+        auto actual = get_default_field(std::make_shared<DataTypeStruct>(
+                DataTypes {nullable_int_type, nullable_string_type}));
+        ASSERT_EQ(actual.get_type(), TYPE_STRUCT);
+        const auto& tuple = actual.get<TYPE_STRUCT>();
+        ASSERT_EQ(tuple.size(), 2);
+        EXPECT_TRUE(tuple[0].is_null());
+        EXPECT_TRUE(tuple[1].is_null());
+    }
+
+    {
+        SCOPED_TRACE("agg_state<count>");
+        auto actual = get_default_field(std::make_shared<DataTypeAggState>(
+                DataTypes {int_type}, false, "count", 
BeExecVersionManager::get_newest_version()));
+        ASSERT_EQ(actual.get_type(), TYPE_STRING);
+        EXPECT_EQ(actual.get<TYPE_STRING>(), String(8, '\0'));
+    }
+}
+
+} // namespace
+} // namespace doris
\ No newline at end of file
diff --git a/be/test/core/data_type/data_type_jsonb_test.cpp 
b/be/test/core/data_type/data_type_jsonb_test.cpp
index 84b0f44dc27..75404cad8e4 100644
--- a/be/test/core/data_type/data_type_jsonb_test.cpp
+++ b/be/test/core/data_type/data_type_jsonb_test.cpp
@@ -263,12 +263,6 @@ TEST_F(DataTypeJsonbTest, simple_func_test) {
         EXPECT_TRUE(dt.equals(dt));
 
         EXPECT_EQ(std::string(dt.get_family_name()), std::string("JSONB"));
-
-        JsonBinaryValue jsonb_value;
-        THROW_IF_ERROR(jsonb_value.from_json_string("null"));
-        EXPECT_EQ(dt.get_default(),
-                  Field::create_field<TYPE_JSONB>(
-                          JsonbField(jsonb_value.value(), 
cast_set<Int32>(jsonb_value.size()))));
     };
     test_func(dt_jsonb);
     EXPECT_EQ(dt_jsonb.get_primitive_type(), TYPE_JSONB);
diff --git a/be/test/core/data_type/data_type_number_test.cpp 
b/be/test/core/data_type/data_type_number_test.cpp
index 5b8885ac3f3..3a0182acde1 100644
--- a/be/test/core/data_type/data_type_number_test.cpp
+++ b/be/test/core/data_type/data_type_number_test.cpp
@@ -149,13 +149,6 @@ TEST_F(DataTypeNumberTest, get_storage_field_type) {
 
     EXPECT_EQ(dt_uint8.get_storage_field_type(), 
doris::FieldType::OLAP_FIELD_TYPE_BOOL);
 }
-TEST_F(DataTypeNumberTest, get_default) {
-    EXPECT_EQ(dt_int8.get_default(), Field::create_field<TYPE_TINYINT>(0));
-    EXPECT_EQ(dt_int16.get_default(), Field::create_field<TYPE_SMALLINT>(0));
-    EXPECT_EQ(dt_int32.get_default(), Field::create_field<TYPE_INT>(0));
-    EXPECT_EQ(dt_int64.get_default(), Field::create_field<TYPE_BIGINT>(0));
-    EXPECT_EQ(dt_int128.get_default(), 
Field::create_field<TYPE_LARGEINT>(Int128(0)));
-}
 template <PrimitiveType T>
 void test_int_field(const typename PrimitiveTypeTraits<T>::DataType& dt) {
     TExprNode expr_node;
diff --git a/be/test/core/data_type/data_type_string_test.cpp 
b/be/test/core/data_type/data_type_string_test.cpp
index b6d3b246a5c..a8bc0ff4c8f 100644
--- a/be/test/core/data_type/data_type_string_test.cpp
+++ b/be/test/core/data_type/data_type_string_test.cpp
@@ -266,8 +266,6 @@ TEST_F(DataTypeStringTest, simple_func_test) {
         EXPECT_TRUE(dt.equals(dt));
 
         EXPECT_EQ(std::string(dt.get_family_name()), std::string("String"));
-
-        EXPECT_EQ(dt.get_default(), 
Field::create_field<TYPE_STRING>(String()));
     };
     test_func(dt_str);
     EXPECT_EQ(dt_str.get_primitive_type(), TYPE_STRING);
diff --git a/be/test/core/data_type/data_type_varbinary_test.cpp 
b/be/test/core/data_type/data_type_varbinary_test.cpp
index e592118e6ee..8a99377dec7 100644
--- a/be/test/core/data_type/data_type_varbinary_test.cpp
+++ b/be/test/core/data_type/data_type_varbinary_test.cpp
@@ -86,13 +86,6 @@ TEST_F(DataTypeVarbinaryTest, CreateColumnAndCheckColumn) {
     EXPECT_FALSE(dt.check_column(*wrong).ok());
 }
 
-TEST_F(DataTypeVarbinaryTest, GetDefaultField) {
-    DataTypeVarbinary dt;
-    Field def = dt.get_default();
-    const auto& sv = def.get<TYPE_VARBINARY>();
-    EXPECT_EQ(sv.size(), 0U);
-}
-
 TEST_F(DataTypeVarbinaryTest, ToStringAndToStringBufferWritable) {
     DataTypeVarbinary dt;
     auto col = dt.create_column();
diff --git 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_complex_type.out
 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_complex_type.out
index 6f6a385a359..279077bc86a 100644
--- 
a/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_complex_type.out
+++ 
b/regression-test/data/unique_with_mow_p0/partial_update/test_partial_update_complex_type.out
@@ -26,9 +26,9 @@
 
 -- !sql --
 1      doris1  {"jsonk1":123,"jsonk2":456}     [100, 200]      {"a":1, "b":2}  
{"b":3} 3       0
-1      \N      null    [null]  {"a":null, "b":null}    {null:null}     5       
1
+1      \N      NULL    []      {"a":null, "b":null}    {}      5       1
 2      doris2  {"jsonk2":333,"jsonk4":444}     [300, 400]      {"a":3, "b":4}  
{"a":2} 2       0
-2      \N      null    [null]  {"a":null, "b":null}    {null:null}     5       
1
+2      \N      NULL    []      {"a":null, "b":null}    {}      5       1
 3      doris3  {"jsonk3":456,"jsonk5":789}     [600, 400]      {"a":2, "b":7}  
{"cccc":10}     4       0
 
 -- !update_varchar --
@@ -58,8 +58,8 @@
 
 -- !sql --
 1      doris1  {"jsonk1":123,"jsonk2":456}     [100, 200]      {"a":1, "b":2}  
{"b":3} 3       0
-1      \N      null    [null]  {"a":null, "b":null}    {null:null}     5       
1
+1      \N      NULL    []      {"a":null, "b":null}    {}      5       1
 2      doris2  {"jsonk2":333,"jsonk4":444}     [300, 400]      {"a":3, "b":4}  
{"a":2} 2       0
-2      \N      null    [null]  {"a":null, "b":null}    {null:null}     5       
1
+2      \N      NULL    []      {"a":null, "b":null}    {}      5       1
 3      doris3  {"jsonk3":456,"jsonk5":789}     [600, 400]      {"a":2, "b":7}  
{"cccc":10}     4       0
 


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

Reply via email to