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

HappenLee 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 accd8a04106  [refine](code) remove dead code across core types and 
utilities (#62994)
accd8a04106 is described below

commit accd8a04106b8ed97455fd8259cdc787556a7add
Author: Mryange <[email protected]>
AuthorDate: Thu May 7 10:46:53 2026 +0800

     [refine](code) remove dead code across core types and utilities (#62994)
    
    This PR cleans up dead code accumulated across BE core files — unused
    unions, methods, type
    traits, free functions, forward declarations, and includes that are
    never referenced in the
      codebase. Specific removals include:
    
    - binary_cast.hpp: 5 unreferenced type-punning unions (TypeConverter,
    DecimalInt128Union,
      VecDateTimeInt64Union, DateV2UInt32Union, DateTimeV2UInt64Union)
    - block.cpp/h: unused columns_bytes() and clone_with_columns() methods,
    plus stale includes
    (sys/types.h, iterator, config.h)
    - string_ref.cpp/h: unused single-char start_with/end_with overloads and
    the
    min_string_val/max_string_val/MIN_CHAR/MAX_CHAR scaffolding that served
    type_limit
      specializations
    - type_limit.h: type_limit<StringRef> and type_limit<std::string>
    specializations that depended
    on the removed string_ref helpers
    - number_traits.h: 6 unused type-trait structs
    (ResultOfAdditionMultiplication,
    ResultOfSubtraction, ResultOfFloatingPointDivision,
    ResultOfIntegerDivision, ResultOfModulo,
      ResultOfBit, BinaryOperatorTraits) and stale includes
    - column_variant.cpp/h: unused get_last_field() and is_doc_mode()
    methods
    - nested_utils.cpp/h: unused extract_table_name() and declaration of
    validate_array_sizes()
    - map_value.cpp, struct_value.cpp: entire files deleted — each contained
    only a single unused
    shallow_copy method
    - call_on_type_index.h: stale forward declaration of DataTypeEnum
    - data_type_array_serde.h: stale forward declaration of JsonWriter
    - function_array_enumerate_uniq.cpp, cgroup_util.cpp: added missing
    transitive includes exposed
    after dead-code removal (column_decimal.h, boost/algorithm/string.hpp)
    
    Corresponding tests that exercised only the deleted functions were also
    removed (block_test.cpp,
    column_variant_test.cpp, data_type_serde_test.cpp,
    variant_util_test.cpp).
---
 be/src/core/binary_cast.hpp                        | 34 ---------
 be/src/core/block/block.cpp                        | 33 ---------
 be/src/core/block/block.h                          |  5 --
 be/src/core/call_on_type_index.h                   |  2 -
 be/src/core/column/column_variant.cpp              | 15 ----
 be/src/core/column/column_variant.h                |  6 --
 be/src/core/data_type/nested_utils.cpp             |  5 --
 be/src/core/data_type/nested_utils.h               |  6 --
 be/src/core/data_type/number_traits.h              | 84 ----------------------
 .../core/data_type_serde/data_type_array_serde.h   |  1 -
 be/src/core/string_ref.cpp                         | 13 ----
 be/src/core/string_ref.h                           |  2 -
 be/src/core/value/map_value.cpp                    | 29 --------
 be/src/core/value/map_value.h                      |  2 -
 be/src/core/value/struct_value.cpp                 | 27 -------
 be/src/core/value/struct_value.h                   |  2 -
 .../array/function_array_enumerate_uniq.cpp        |  1 +
 be/src/util/cgroup_util.cpp                        |  1 +
 be/test/core/block/block_test.cpp                  |  2 -
 be/test/core/column/column_variant_test.cpp        | 41 -----------
 .../core/data_type_serde/data_type_serde_test.cpp  | 45 ------------
 be/test/storage/segment/variant_util_test.cpp      | 12 ----
 22 files changed, 2 insertions(+), 366 deletions(-)

diff --git a/be/src/core/binary_cast.hpp b/be/src/core/binary_cast.hpp
index d39944bd9b6..7da0844a3cd 100644
--- a/be/src/core/binary_cast.hpp
+++ b/be/src/core/binary_cast.hpp
@@ -27,46 +27,12 @@
 #include "core/value/vdatetime_value.h"
 
 namespace doris {
-union TypeConverter {
-    uint64_t u64;
-    int64_t i64;
-    uint32_t u32[2];
-    int32_t i32[2];
-    uint8_t u8[8];
-    float flt[2];
-    double dbl;
-};
-
 template <typename C0, typename C1, typename T0, typename T1>
 constexpr bool match_v = std::is_same_v<C0, C1> && std::is_same_v<T0, T1>;
 
-union DecimalInt128Union {
-    DecimalV2Value decimal;
-    PackedInt128 packed128;
-    __int128_t i128;
-};
-
 static_assert(sizeof(DecimalV2Value) == sizeof(PackedInt128));
 static_assert(sizeof(DecimalV2Value) == sizeof(__int128_t));
 
-union VecDateTimeInt64Union {
-    doris::VecDateTimeValue dt;
-    __int64_t i64;
-    ~VecDateTimeInt64Union() {}
-};
-
-union DateV2UInt32Union {
-    DateV2Value<DateV2ValueType> dt;
-    uint32_t ui32;
-    ~DateV2UInt32Union() {}
-};
-
-union DateTimeV2UInt64Union {
-    DateV2Value<DateTimeV2ValueType> dt;
-    uint64_t ui64;
-    ~DateTimeV2UInt64Union() {}
-};
-
 // similar to reinterpret_cast but won't break strict-aliasing rules. you can 
treat it as std::bit_cast with type checking
 template <typename From, typename To>
 constexpr PURE To binary_cast(const From& from) {
diff --git a/be/src/core/block/block.cpp b/be/src/core/block/block.cpp
index 446db58f1d2..2bb15632544 100644
--- a/be/src/core/block/block.cpp
+++ b/be/src/core/block/block.cpp
@@ -25,18 +25,15 @@
 #include <glog/logging.h>
 #include <snappy.h>
 #include <streamvbyte.h>
-#include <sys/types.h>
 
 #include <algorithm>
 #include <cassert>
 #include <iomanip>
-#include <iterator>
 #include <limits>
 #include <ranges>
 
 #include "agent/be_exec_version_manager.h"
 #include "common/compiler_util.h" // IWYU pragma: keep
-#include "common/config.h"
 #include "common/logging.h"
 #include "common/status.h"
 #include "core/assert_cast.h"
@@ -353,25 +350,6 @@ size_t Block::bytes() const {
     return res;
 }
 
-std::string Block::columns_bytes() const {
-    std::stringstream res;
-    res << "column bytes: [";
-    for (const auto& elem : data) {
-        if (!elem.column) {
-            std::stringstream ss;
-            for (const auto& e : data) {
-                ss << e.name + " ";
-            }
-            throw Exception(ErrorCode::INTERNAL_ERROR,
-                            "Column {} in block is nullptr, in method bytes. 
All Columns are {}",
-                            elem.name, ss.str());
-        }
-        res << ", " << elem.column->byte_size();
-    }
-    res << "]";
-    return res.str();
-}
-
 size_t Block::allocated_bytes() const {
     size_t res = 0;
     for (const auto& elem : data) {
@@ -619,17 +597,6 @@ void Block::set_columns(MutableColumns&& columns) {
     }
 }
 
-Block Block::clone_with_columns(MutableColumns&& columns) const {
-    Block res;
-
-    size_t num_columns = data.size();
-    for (size_t i = 0; i < num_columns; ++i) {
-        res.insert({std::move(columns[i]), data[i].type, data[i].name});
-    }
-
-    return res;
-}
-
 Block Block::clone_without_columns(const std::vector<int>* column_offset) 
const {
     Block res;
 
diff --git a/be/src/core/block/block.h b/be/src/core/block/block.h
index 81ada533773..62186b36cce 100644
--- a/be/src/core/block/block.h
+++ b/be/src/core/block/block.h
@@ -188,9 +188,6 @@ public:
     /// and is the metric used by adaptive batch size byte budgets.
     size_t bytes() const;
 
-    /// Returns per-column byte sizes as a comma-separated string (for 
debugging).
-    std::string columns_bytes() const;
-
     /// Approximate number of allocated (reserved) bytes in memory.
     /// This may be larger than bytes() due to pre-allocated capacity in 
vectors/arenas.
     /// Used for memory tracking and profiling.
@@ -220,8 +217,6 @@ public:
 
     /** Replace columns in a block */
     void set_columns(MutableColumns&& columns);
-    Block clone_with_columns(MutableColumns&& columns) const;
-
     void clear();
     void swap(Block& other) noexcept;
     void swap(Block&& other) noexcept;
diff --git a/be/src/core/call_on_type_index.h b/be/src/core/call_on_type_index.h
index c82c8529551..98aad077413 100644
--- a/be/src/core/call_on_type_index.h
+++ b/be/src/core/call_on_type_index.h
@@ -41,8 +41,6 @@ class DataTypeDateTime;
 class DataTypeIPv4;
 class DataTypeIPv6;
 class DataTypeString;
-template <typename T>
-class DataTypeEnum;
 template <PrimitiveType T>
 class DataTypeNumber;
 template <PrimitiveType T>
diff --git a/be/src/core/column/column_variant.cpp 
b/be/src/core/column/column_variant.cpp
index 050709401af..4915be40523 100644
--- a/be/src/core/column/column_variant.cpp
+++ b/be/src/core/column/column_variant.cpp
@@ -339,16 +339,6 @@ ColumnVariant::Subcolumn 
ColumnVariant::Subcolumn::clone_with_default_values(
     return new_subcolumn;
 }
 
-Field ColumnVariant::Subcolumn::get_last_field() const {
-    if (data.empty()) {
-        return Field();
-    }
-
-    const auto& last_part = data.back();
-    assert(!last_part->empty());
-    return (*last_part)[last_part->size() - 1];
-}
-
 void ColumnVariant::Subcolumn::insert_range_from(const Subcolumn& src, size_t 
start,
                                                  size_t length) {
     if (start + length > src.size()) {
@@ -2676,9 +2666,4 @@ MutableColumnPtr ColumnVariant::clone() const {
     return res;
 }
 
-bool ColumnVariant::is_doc_mode() const {
-    const auto& offset = serialized_doc_value_column_offsets();
-    return subcolumns.size() == 1 && offset[num_rows - 1] != 0;
-}
-
 } // namespace doris
diff --git a/be/src/core/column/column_variant.h 
b/be/src/core/column/column_variant.h
index 9b7d84df525..4794742e038 100644
--- a/be/src/core/column/column_variant.h
+++ b/be/src/core/column/column_variant.h
@@ -172,9 +172,6 @@ public:
         /// creates a single column that stores all values.
         void finalize(FinalizeMode mode = FinalizeMode::READ_MODE);
 
-        /// Returns last inserted field.
-        Field get_last_field() const;
-
         void deserialize_from_binary_column(const ColumnString* value, size_t 
row);
 
         /// Returns single column if subcolumn in finalizes.
@@ -640,9 +637,6 @@ public:
         return _max_subcolumns_count - current_subcolumns_count;
     }
 
-    // doc snapshot mode: only root column, and doc snapshot column is not 
empty
-    bool is_doc_mode() const;
-
     void try_get_from_doc_value_column(size_t n, Field& res) const;
 
     void insert_to_doc_value_column(const Field& field);
diff --git a/be/src/core/data_type/nested_utils.cpp 
b/be/src/core/data_type/nested_utils.cpp
index ba48234931a..d0e98d76155 100644
--- a/be/src/core/data_type/nested_utils.cpp
+++ b/be/src/core/data_type/nested_utils.cpp
@@ -61,11 +61,6 @@ std::pair<std::string, std::string> splitName(const 
std::string& name) {
     return {{begin, first_end}, {second_begin, end}};
 }
 
-std::string extract_table_name(const std::string& nested_name) {
-    auto splitted = splitName(nested_name);
-    return splitted.first;
-}
-
 } // namespace Nested
 
 } // namespace doris
diff --git a/be/src/core/data_type/nested_utils.h 
b/be/src/core/data_type/nested_utils.h
index 8a7d166e8c8..08e5e188b2d 100644
--- a/be/src/core/data_type/nested_utils.h
+++ b/be/src/core/data_type/nested_utils.h
@@ -33,14 +33,8 @@ std::string concatenate_name(const std::string& 
nested_table_name,
 
 std::pair<std::string, std::string> splitName(const std::string& name);
 
-/// Returns the prefix of the name to the first '.'. Or the name is unchanged 
if there is no dot.
-std::string extract_table_name(const std::string& nested_name);
-
 /// Replace Array(Tuple(...)) columns to a multiple of Array columns in a form 
of `column_name.element_name`.
 Block flatten(const Block& block);
-
-/// Check that sizes of arrays - elements of nested data structures - are 
equal.
-void validate_array_sizes(const Block& block);
 } // namespace Nested
 
 } // namespace doris
diff --git a/be/src/core/data_type/number_traits.h 
b/be/src/core/data_type/number_traits.h
index 0039bb92076..a08c77889ae 100644
--- a/be/src/core/data_type/number_traits.h
+++ b/be/src/core/data_type/number_traits.h
@@ -23,11 +23,8 @@
 #include <climits>
 #include <type_traits>
 
-#include "core/column/column_decimal.h"
-#include "core/column/column_vector.h"
 #include "core/extended_types.h"
 #include "core/types.h"
-#include "core/uint128.h"
 
 namespace doris {
 
@@ -143,68 +140,6 @@ struct Construct<true, true, 16> {
     static constexpr PrimitiveType Type = TYPE_DOUBLE;
 };
 
-/** The result of addition or multiplication is calculated according to the 
following rules:
-    * - if one of the arguments is floating-point, the result is a floating 
point, otherwise - the whole;
-    * - if one of the arguments is signed, the result is signed, otherwise it 
is unsigned;
-    * - the result contains more bits (not only meaningful) than the maximum 
in the arguments
-    *   (for example, UInt8 + Int32 = Int64).
-    */
-template <typename A, typename B>
-struct ResultOfAdditionMultiplication {
-    static constexpr PrimitiveType Type = Construct < IsSignedV<A> || 
IsSignedV<B>,
-                                   std::is_floating_point_v<A> || 
std::is_floating_point_v<B>,
-                                   next_size(max(sizeof(A), sizeof(B))) > 
::Type;
-};
-
-template <typename A, typename B>
-struct ResultOfSubtraction {
-    static constexpr PrimitiveType Type = Construct < true,
-                                   std::is_floating_point_v<A> || 
std::is_floating_point_v<B>,
-                                   next_size(max(sizeof(A), sizeof(B))) > 
::Type;
-};
-
-/** When dividing, you always get a floating-point number.
-    */
-template <typename A, typename B>
-struct ResultOfFloatingPointDivision {
-    struct DoubleField {
-        static constexpr PrimitiveType PType = TYPE_DOUBLE;
-    };
-    static constexpr PrimitiveType Type =
-            std::conditional_t<IsDecimalNumber<A>, A,
-                               std::conditional_t<IsDecimalNumber<B>, B, 
DoubleField>>::PType;
-};
-
-/** For integer division, we get a number with the same number of bits as in 
divisible.
-    */
-template <typename A, typename B>
-struct ResultOfIntegerDivision {
-    static constexpr PrimitiveType Type = Construct < IsSignedV<A> || 
IsSignedV<B>, false,
-                                   sizeof(A) > ::Type;
-};
-
-/** Division with remainder you get a number with the same number of bits as 
in divisor.
-    */
-template <typename A, typename B>
-struct ResultOfModulo {
-    constexpr static auto has_float = std::is_floating_point_v<A> || 
std::is_floating_point_v<B>;
-    consteval static auto result_size() {
-        if constexpr (!has_float) {
-            return max(sizeof(A), sizeof(B));
-        }
-        size_t max_float_size = 0;
-        if constexpr (std::is_floating_point_v<A>) {
-            max_float_size = max(max_float_size, sizeof(A));
-        }
-        if constexpr (std::is_floating_point_v<B>) {
-            max_float_size = max(max_float_size, sizeof(B));
-        }
-        return max_float_size;
-    }
-    static constexpr PrimitiveType Type = Construct < IsSignedV<A> || 
IsSignedV<B>, has_float,
-                                   result_size() > ::Type;
-};
-
 template <typename A>
 struct ResultOfAbs {
     static constexpr PrimitiveType Type =
@@ -237,30 +172,11 @@ struct ResultOfAbs<Decimal128V3> {
     static constexpr PrimitiveType Type = TYPE_DECIMAL128I;
 };
 
-/** For bitwise operations, an integer is obtained with number of bits is 
equal to the maximum of the arguments.
-    */
-template <typename A, typename B>
-struct ResultOfBit {
-    static constexpr PrimitiveType Type = Construct < IsSignedV<A> || 
IsSignedV<B>, false,
-                                   std::is_floating_point_v<A> || 
std::is_floating_point_v<B>
-                                           ? 8
-                                           : max(sizeof(A), sizeof(B)) > 
::Type;
-};
-
 template <typename A>
 struct ResultOfBitNot {
     static constexpr PrimitiveType Type = Construct<IsSignedV<A>, false, 
sizeof(A)>::Type;
 };
 
-template <PrimitiveType A, PrimitiveType B>
-struct BinaryOperatorTraits {
-    using ColumnVectorA = typename PrimitiveTypeTraits<A>::ColumnType;
-    using ColumnVectorB = typename PrimitiveTypeTraits<B>::ColumnType;
-    using ArrayA = typename ColumnVectorA::Container;
-    using ArrayB = typename ColumnVectorB::Container;
-    using ArrayNull = PaddedPODArray<UInt8>;
-};
-
 template <typename T>
 /// Returns the maximum ascii string length for this type.
 /// e.g. the max/min int8_t has 3 characters.
diff --git a/be/src/core/data_type_serde/data_type_array_serde.h 
b/be/src/core/data_type_serde/data_type_array_serde.h
index 2fcb7f3c9c4..a7a37f324d2 100644
--- a/be/src/core/data_type_serde/data_type_array_serde.h
+++ b/be/src/core/data_type_serde/data_type_array_serde.h
@@ -30,7 +30,6 @@
 namespace doris {
 class PValues;
 struct JsonbValue;
-class JsonWriter;
 
 class IColumn;
 class Arena;
diff --git a/be/src/core/string_ref.cpp b/be/src/core/string_ref.cpp
index a38c6c22104..6428d6968e0 100644
--- a/be/src/core/string_ref.cpp
+++ b/be/src/core/string_ref.cpp
@@ -94,19 +94,6 @@ StringRef StringRef::max_string_val() {
     return StringRef((char*)(&StringRef::MAX_CHAR), 1);
 }
 
-bool StringRef::start_with(char ch) const {
-    if (UNLIKELY(size == 0)) {
-        return false;
-    }
-    return data[0] == ch;
-}
-bool StringRef::end_with(char ch) const {
-    if (UNLIKELY(size == 0)) {
-        return false;
-    }
-    return data[size - 1] == ch;
-}
-
 bool StringRef::start_with(const StringRef& search_string) const {
     if (search_string.size == 0) {
         return true;
diff --git a/be/src/core/string_ref.h b/be/src/core/string_ref.h
index 117fb2539e2..2902d9a8f30 100644
--- a/be/src/core/string_ref.h
+++ b/be/src/core/string_ref.h
@@ -232,8 +232,6 @@ struct StringRef {
     static StringRef min_string_val();
     static StringRef max_string_val();
 
-    bool start_with(char) const;
-    bool end_with(char) const;
     bool start_with(const StringRef& search_string) const;
     bool end_with(const StringRef& search_string) const;
 
diff --git a/be/src/core/value/map_value.cpp b/be/src/core/value/map_value.cpp
deleted file mode 100644
index f9e77c95268..00000000000
--- a/be/src/core/value/map_value.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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 "core/value/map_value.h"
-
-namespace doris {
-
-///====================== map-value funcs ======================///
-void MapValue::shallow_copy(const MapValue* value) {
-    _length = value->_length;
-    _key_data = value->_key_data;
-    _value_data = value->_value_data;
-}
-
-} // namespace doris
diff --git a/be/src/core/value/map_value.h b/be/src/core/value/map_value.h
index 6167b401247..68480cdbcb5 100644
--- a/be/src/core/value/map_value.h
+++ b/be/src/core/value/map_value.h
@@ -37,8 +37,6 @@ public:
 
     int32_t length() const { return _length; }
 
-    void shallow_copy(const MapValue* other);
-
     const void* key_data() const { return _key_data; }
     void* mutable_key_data() const { return _key_data; }
     const void* value_data() const { return _value_data; }
diff --git a/be/src/core/value/struct_value.cpp 
b/be/src/core/value/struct_value.cpp
deleted file mode 100644
index e440bd53dc8..00000000000
--- a/be/src/core/value/struct_value.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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 "core/value/struct_value.h"
-
-namespace doris {
-
-void StructValue::shallow_copy(const StructValue* other) {
-    _size = other->_size;
-    _values = other->_values;
-    _has_null = other->_has_null;
-}
-} // namespace doris
\ No newline at end of file
diff --git a/be/src/core/value/struct_value.h b/be/src/core/value/struct_value.h
index dc9ff1426cf..fa79a3e0a9b 100644
--- a/be/src/core/value/struct_value.h
+++ b/be/src/core/value/struct_value.h
@@ -41,8 +41,6 @@ public:
         return this->_has_null && this->_values[index] == nullptr;
     }
 
-    void shallow_copy(const StructValue* other);
-
     const void** values() const { return const_cast<const void**>(_values); }
     void** mutable_values() { return _values; }
     void set_values(void** values) { _values = values; }
diff --git a/be/src/exprs/function/array/function_array_enumerate_uniq.cpp 
b/be/src/exprs/function/array/function_array_enumerate_uniq.cpp
index 2fc8df588e8..494076f926f 100644
--- a/be/src/exprs/function/array/function_array_enumerate_uniq.cpp
+++ b/be/src/exprs/function/array/function_array_enumerate_uniq.cpp
@@ -36,6 +36,7 @@
 #include "core/call_on_type_index.h"
 #include "core/column/column.h"
 #include "core/column/column_array.h"
+#include "core/column/column_decimal.h"
 #include "core/column/column_nullable.h"
 #include "core/column/column_vector.h"
 #include "core/data_type/data_type.h"
diff --git a/be/src/util/cgroup_util.cpp b/be/src/util/cgroup_util.cpp
index 5b0b55b183c..cfda0a4fb77 100644
--- a/be/src/util/cgroup_util.cpp
+++ b/be/src/util/cgroup_util.cpp
@@ -21,6 +21,7 @@
 #include <absl/strings/str_split.h>
 
 #include <algorithm>
+#include <boost/algorithm/string.hpp>
 #include <fstream>
 #include <utility>
 #include <vector>
diff --git a/be/test/core/block/block_test.cpp 
b/be/test/core/block/block_test.cpp
index 12486d269f7..1bb930bb15a 100644
--- a/be/test/core/block/block_test.cpp
+++ b/be/test/core/block/block_test.cpp
@@ -1147,8 +1147,6 @@ TEST(BlockTest, check_number_of_rows) {
     
block.insert(ColumnHelper::create_column_with_name<DataTypeString>({"abc"}));
     EXPECT_ANY_THROW(block.check_number_of_rows(true));
 
-    EXPECT_ANY_THROW(block.columns_bytes());
-
     ASSERT_GT(block.allocated_bytes(), 0);
 }
 
diff --git a/be/test/core/column/column_variant_test.cpp 
b/be/test/core/column/column_variant_test.cpp
index 9825f836186..9f32156b855 100644
--- a/be/test/core/column/column_variant_test.cpp
+++ b/be/test/core/column/column_variant_test.cpp
@@ -1497,26 +1497,6 @@ TEST_F(ColumnVariantTest, get_dimensions) {
     test_func(column_variant);
 }
 
-TEST_F(ColumnVariantTest, get_last_field) {
-    auto test_func = [](const auto& source_column) {
-        auto src_size = source_column->size();
-        EXPECT_TRUE(src_size > 0);
-
-        // Test get_last_field for root column
-        const auto& root = source_column->get_subcolumns().get_root();
-        EXPECT_TRUE(root != nullptr);
-        Field last_field;
-        root->data.get_last_field();
-
-        // Test get_last_field for subcolumns
-        for (const auto& subcolumn : source_column->get_subcolumns()) {
-            EXPECT_TRUE(subcolumn != nullptr);
-            subcolumn->data.get_last_field();
-        }
-    };
-    test_func(column_variant);
-}
-
 // sub column op related interface
 TEST_F(ColumnVariantTest, get_finalized_column) {
     auto test_func = [](const auto& source_column) {
@@ -2285,8 +2265,6 @@ TEST_F(ColumnVariantTest, array_field_operations) {
             EXPECT_TRUE(subcolumn != nullptr);
             EXPECT_TRUE(subcolumn->size() > 0);
             std::cout << "subcolumn size: " << subcolumn->size() << std::endl;
-            Field f = subcolumn->get_last_field();
-            EXPECT_TRUE(f.get_type() == PrimitiveType::TYPE_ARRAY);
 
             // Create field info
             FieldInfo info;
@@ -3479,21 +3457,12 @@ TEST_F(ColumnVariantTest, 
test_variant_deserialize_from_sparse_column) {
     //                  PrimitiveType::TYPE_ARRAY);
     //        EXPECT_EQ(subcolumn.get_dimensions(), 1);
     //        EXPECT_EQ(subcolumn.get_least_common_base_type_id(), 
PrimitiveType::TYPE_TINYINT);
-    //        auto v = subcolumn.get_last_field();
-    //        auto& arr = v.get<TYPE_ARRAY>();
-    //        EXPECT_EQ(arr.size(), 1);
-    //        EXPECT_EQ(arr[0].get<TYPE_TINYINT>(), 123);
-    //
     //        subcolumn.deserialize_from_binary_column(&value, 1);
     //        EXPECT_EQ(subcolumn.data.size(), 2);
     //        
EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
     //                  PrimitiveType::TYPE_ARRAY);
     //        EXPECT_EQ(subcolumn.get_dimensions(), 1);
     //        EXPECT_EQ(subcolumn.get_least_common_base_type_id(), 
PrimitiveType::TYPE_INT);
-    //        auto v2 = subcolumn.get_last_field();
-    //        auto& arr2 = v2.get<TYPE_ARRAY>();
-    //        EXPECT_EQ(arr2.size(), 1);
-    //        EXPECT_EQ(arr2[0].get<TYPE_INT>(), 123);
     //    }
     //
     //    column_map.clear();
@@ -3525,22 +3494,12 @@ TEST_F(ColumnVariantTest, 
test_variant_deserialize_from_sparse_column) {
     //        
EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
     //                  PrimitiveType::TYPE_ARRAY);
     //        EXPECT_EQ(subcolumn.get_dimensions(), 1);
-    //        auto v = subcolumn.get_last_field();
-    //        auto& arr = v.get<TYPE_ARRAY>();
-    //        EXPECT_EQ(arr.size(), 1);
-    //        EXPECT_TRUE(arr[0].is_null());
-    //
     //        subcolumn.deserialize_from_binary_column(&value, 1);
     //        EXPECT_EQ(subcolumn.data.size(), 2);
     //        
EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
     //                  PrimitiveType::TYPE_ARRAY);
     //        EXPECT_EQ(subcolumn.get_dimensions(), 1);
     //        EXPECT_EQ(subcolumn.get_least_common_base_type_id(), 
PrimitiveType::TYPE_INT);
-    //        auto v2 = subcolumn.get_last_field();
-    //        auto& arr2 = v2.get<TYPE_ARRAY>();
-    //        EXPECT_EQ(arr2.size(), 2);
-    //        EXPECT_TRUE(arr2[0].is_null());
-    //        EXPECT_EQ(arr2[1].get<TYPE_INT>(), 123);
     //    }
 }
 
diff --git a/be/test/core/data_type_serde/data_type_serde_test.cpp 
b/be/test/core/data_type_serde/data_type_serde_test.cpp
index bc23518ff88..9e402179a63 100644
--- a/be/test/core/data_type_serde/data_type_serde_test.cpp
+++ b/be/test/core/data_type_serde/data_type_serde_test.cpp
@@ -424,12 +424,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_STRING);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_STRING>(), "123");
         subcolumn.deserialize_from_binary_column(&value, 0);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_STRING);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_STRING>(), "123");
     }
 
     {
@@ -437,11 +435,9 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         subcolumn.deserialize_from_binary_column(&value, 1);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(), 
PrimitiveType::TYPE_INT);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_INT>(), 123);
         subcolumn.deserialize_from_binary_column(&value, 1);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(), 
PrimitiveType::TYPE_INT);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_INT>(), 123);
     }
 
     {
@@ -450,12 +446,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_LARGEINT);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_LARGEINT>(), 123);
         subcolumn.deserialize_from_binary_column(&value, 2);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_LARGEINT);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_LARGEINT>(), 123);
     }
 
     {
@@ -464,12 +458,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DOUBLE);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_DOUBLE>(), 123.456);
         subcolumn.deserialize_from_binary_column(&value, 3);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DOUBLE);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_DOUBLE>(), 123.456);
     }
 
     {
@@ -478,12 +470,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_BOOLEAN);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_BOOLEAN>(), true);
         subcolumn.deserialize_from_binary_column(&value, 4);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_BOOLEAN);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_BOOLEAN>(), true);
     }
 
     {
@@ -492,12 +482,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DATETIMEV2);
-        
EXPECT_EQ(subcolumn.get_last_field().get<TYPE_DATETIMEV2>().to_date_int_val(), 
23232323);
         subcolumn.deserialize_from_binary_column(&value, 5);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DATETIMEV2);
-        
EXPECT_EQ(subcolumn.get_last_field().get<TYPE_DATETIMEV2>().to_date_int_val(), 
23232323);
     }
 
     {
@@ -506,12 +494,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DATEV2);
-        
EXPECT_EQ(subcolumn.get_last_field().get<TYPE_DATEV2>().to_date_int_val(), 
154543245);
         subcolumn.deserialize_from_binary_column(&value, 6);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DATEV2);
-        
EXPECT_EQ(subcolumn.get_last_field().get<TYPE_DATEV2>().to_date_int_val(), 
154543245);
     }
 
     {
@@ -520,12 +506,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_IPV4);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_IPV4>(), 
static_cast<IPv4>(367357));
         subcolumn.deserialize_from_binary_column(&value, 7);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_IPV4);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_IPV4>(), 
static_cast<IPv4>(367357));
     }
 
     {
@@ -534,12 +518,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_IPV6);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_IPV6>(), 
static_cast<IPv6>(36534645));
         subcolumn.deserialize_from_binary_column(&value, 8);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_IPV6);
-        EXPECT_EQ(subcolumn.get_last_field().get<TYPE_IPV6>(), 
static_cast<IPv6>(36534645));
     }
 
     {
@@ -548,8 +530,6 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DECIMAL32);
-        auto v = subcolumn.get_last_field().get<TYPE_DECIMAL32>();
-        EXPECT_EQ(static_cast<Int32>(v), static_cast<Int32>(3456345634));
         subcolumn.deserialize_from_binary_column(&value, 9);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
@@ -562,14 +542,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DECIMAL64);
-        auto v = subcolumn.get_last_field().get<TYPE_DECIMAL64>();
-        EXPECT_EQ(static_cast<Int64>(v), static_cast<Int64>(13452435));
         subcolumn.deserialize_from_binary_column(&value, 10);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DECIMAL64);
-        v = subcolumn.get_last_field().get<TYPE_DECIMAL64>();
-        EXPECT_EQ(static_cast<Int64>(v), static_cast<Int64>(13452435));
     }
 
     {
@@ -578,14 +554,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DECIMAL128I);
-        auto v = subcolumn.get_last_field().get<TYPE_DECIMAL128I>();
-        EXPECT_EQ(static_cast<Int128>(v), static_cast<Int128>(2342345));
         subcolumn.deserialize_from_binary_column(&value, 11);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DECIMAL128I);
-        v = subcolumn.get_last_field().get<TYPE_DECIMAL128I>();
-        EXPECT_EQ(static_cast<Int128>(v), static_cast<Int128>(2342345));
     }
 
     {
@@ -594,14 +566,10 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DECIMAL256);
-        auto v = subcolumn.get_last_field().get<TYPE_DECIMAL256>();
-        EXPECT_TRUE(v == Decimal256(2345243));
         subcolumn.deserialize_from_binary_column(&value, 12);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_DECIMAL256);
-        v = subcolumn.get_last_field().get<TYPE_DECIMAL256>();
-        EXPECT_TRUE(v == Decimal256(2345243));
     }
 
     {
@@ -624,25 +592,12 @@ TEST(DataTypeSerDeTest, DeserializeFromSparseColumnTest) {
                   PrimitiveType::TYPE_ARRAY);
         EXPECT_EQ(subcolumn.get_dimensions(), 1);
         EXPECT_EQ(subcolumn.get_least_common_base_type_id(), 
PrimitiveType::TYPE_JSONB);
-        auto v = subcolumn.get_last_field();
-        auto& arr = v.get<TYPE_ARRAY>();
-        EXPECT_EQ(arr.size(), 3);
-        EXPECT_FALSE(arr[0].is_null());
-        EXPECT_TRUE(arr[1].is_null());
-        EXPECT_FALSE(arr[2].is_null());
         subcolumn.deserialize_from_binary_column(&value, 14);
         EXPECT_EQ(subcolumn.data.size(), 1);
         EXPECT_EQ(subcolumn.get_least_common_type()->get_primitive_type(),
                   PrimitiveType::TYPE_ARRAY);
         EXPECT_EQ(subcolumn.get_dimensions(), 1);
         EXPECT_EQ(subcolumn.get_least_common_base_type_id(), 
PrimitiveType::TYPE_JSONB);
-
-        v = subcolumn.get_last_field();
-        arr = v.get<TYPE_ARRAY>();
-        EXPECT_EQ(arr.size(), 3);
-        EXPECT_FALSE(arr[0].is_null());
-        EXPECT_TRUE(arr[1].is_null());
-        EXPECT_FALSE(arr[2].is_null());
     }
 }
 } // namespace doris
diff --git a/be/test/storage/segment/variant_util_test.cpp 
b/be/test/storage/segment/variant_util_test.cpp
index e9f126faca0..597623c1018 100644
--- a/be/test/storage/segment/variant_util_test.cpp
+++ b/be/test/storage/segment/variant_util_test.cpp
@@ -57,8 +57,6 @@ TEST(VariantUtilTest, 
ParseDocValueToSubcolumns_FillsDefaultsAndValues) {
     cfg.parse_to = ParseConfig::ParseTo::OnlyDocValueColumn;
     parse_json_to_variant(*variant, *json_col, cfg);
 
-    EXPECT_TRUE(variant->is_doc_mode());
-
     auto subcolumns = materialize_docs_to_subcolumns_map(*variant);
     ASSERT_TRUE(subcolumns.contains("a"));
     ASSERT_TRUE(subcolumns.contains("b"));
@@ -110,8 +108,6 @@ TEST(VariantUtilTest, 
MaterializeDocsToSubcolumnsMap_ExpectedUniquePathsPreserve
     cfg.parse_to = ParseConfig::ParseTo::OnlyDocValueColumn;
     parse_json_to_variant(*variant, *json_col, cfg);
 
-    EXPECT_TRUE(variant->is_doc_mode());
-
     auto default_subcolumns = materialize_docs_to_subcolumns_map(*variant);
     auto subcolumns = materialize_docs_to_subcolumns_map(*variant, 3);
     ASSERT_EQ(subcolumns.size(), default_subcolumns.size());
@@ -170,8 +166,6 @@ TEST(VariantUtilTest, 
ParseOnlyDocValueColumn_SerializesMixedTypes) {
     cfg.parse_to = ParseConfig::ParseTo::OnlyDocValueColumn;
     parse_json_to_variant(*variant, *json_col, cfg);
 
-    EXPECT_TRUE(variant->is_doc_mode());
-
     auto subcolumns = materialize_docs_to_subcolumns_map(*variant);
     ASSERT_TRUE(subcolumns.contains("b"));
     ASSERT_TRUE(subcolumns.contains("d"));
@@ -286,8 +280,6 @@ TEST(VariantUtilTest, 
ParseVariantColumns_DocModeBinaryToSubcolumns) {
     cfg.deprecated_enable_flatten_nested = false;
     cfg.parse_to = ParseConfig::ParseTo::OnlyDocValueColumn;
     parse_json_to_variant(*variant, *json_col, cfg);
-    ASSERT_TRUE(variant->is_doc_mode());
-
     Block block;
     block.insert({variant->get_ptr(), std::make_shared<DataTypeVariant>(0, 
true), "v"});
 
@@ -299,8 +291,6 @@ TEST(VariantUtilTest, 
ParseVariantColumns_DocModeBinaryToSubcolumns) {
     EXPECT_TRUE(st.ok()) << st.to_string();
 
     const auto& out = assert_cast<const 
ColumnVariant&>(*block.get_by_position(0).column);
-    EXPECT_TRUE(out.is_doc_mode());
-
     const auto* sub_a = out.get_subcolumn(PathInData("a"));
     const auto* sub_b = out.get_subcolumn(PathInData("b"));
     ASSERT_TRUE(sub_a == nullptr);
@@ -339,8 +329,6 @@ TEST(VariantUtilTest, 
ParseVariantColumns_DocModeRejectOnlySubcolumnsConfig) {
     cfg.deprecated_enable_flatten_nested = false;
     cfg.parse_to = ParseConfig::ParseTo::OnlyDocValueColumn;
     parse_json_to_variant(*variant, *json_col, cfg);
-    ASSERT_TRUE(variant->is_doc_mode());
-
     Block block;
     block.insert({variant->get_ptr(), std::make_shared<DataTypeVariant>(0, 
true), "v"});
 


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


Reply via email to