diff --git a/be/src/core/binary_cast.hpp b/be/src/core/binary_cast.hpp index d39944bd9b6e98..7da0844a3cd312 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 constexpr bool match_v = std::is_same_v && std::is_same_v; -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 dt; - uint32_t ui32; - ~DateV2UInt32Union() {} -}; - -union DateTimeV2UInt64Union { - DateV2Value 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 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 446db58f1d23d5..2bb156325443e3 100644 --- a/be/src/core/block/block.cpp +++ b/be/src/core/block/block.cpp @@ -25,18 +25,15 @@ #include #include #include -#include #include #include #include -#include #include #include #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* column_offset) const { Block res; diff --git a/be/src/core/block/block.h b/be/src/core/block/block.h index 81ada533773ce9..62186b36cced7e 100644 --- a/be/src/core/block/block.h +++ b/be/src/core/block/block.h @@ -188,9 +188,6 @@ class Block { /// 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 @@ class Block { /** 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 c82c8529551d4c..98aad077413a56 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 -class DataTypeEnum; template class DataTypeNumber; template diff --git a/be/src/core/column/column_variant.cpp b/be/src/core/column/column_variant.cpp index 050709401aff2a..4915be4052377d 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 9b7d84df52537e..4794742e038723 100644 --- a/be/src/core/column/column_variant.h +++ b/be/src/core/column/column_variant.h @@ -172,9 +172,6 @@ class ColumnVariant final : public COWHelper { /// 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 @@ class ColumnVariant final : public COWHelper { 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 ba48234931a4d3..d0e98d761556e1 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 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 8a7d166e8c8968..08e5e188b2d631 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 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 0039bb920766ab..a08c77889aed37 100644 --- a/be/src/core/data_type/number_traits.h +++ b/be/src/core/data_type/number_traits.h @@ -23,11 +23,8 @@ #include #include -#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 { 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 -struct ResultOfAdditionMultiplication { - static constexpr PrimitiveType Type = Construct < IsSignedV || IsSignedV, - std::is_floating_point_v || std::is_floating_point_v, - next_size(max(sizeof(A), sizeof(B))) > ::Type; -}; - -template -struct ResultOfSubtraction { - static constexpr PrimitiveType Type = Construct < true, - std::is_floating_point_v || std::is_floating_point_v, - next_size(max(sizeof(A), sizeof(B))) > ::Type; -}; - -/** When dividing, you always get a floating-point number. - */ -template -struct ResultOfFloatingPointDivision { - struct DoubleField { - static constexpr PrimitiveType PType = TYPE_DOUBLE; - }; - static constexpr PrimitiveType Type = - std::conditional_t, A, - std::conditional_t, B, DoubleField>>::PType; -}; - -/** For integer division, we get a number with the same number of bits as in divisible. - */ -template -struct ResultOfIntegerDivision { - static constexpr PrimitiveType Type = Construct < IsSignedV || IsSignedV, false, - sizeof(A) > ::Type; -}; - -/** Division with remainder you get a number with the same number of bits as in divisor. - */ -template -struct ResultOfModulo { - constexpr static auto has_float = std::is_floating_point_v || std::is_floating_point_v; - 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) { - max_float_size = max(max_float_size, sizeof(A)); - } - if constexpr (std::is_floating_point_v) { - max_float_size = max(max_float_size, sizeof(B)); - } - return max_float_size; - } - static constexpr PrimitiveType Type = Construct < IsSignedV || IsSignedV, has_float, - result_size() > ::Type; -}; - template struct ResultOfAbs { static constexpr PrimitiveType Type = @@ -237,30 +172,11 @@ struct ResultOfAbs { 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 -struct ResultOfBit { - static constexpr PrimitiveType Type = Construct < IsSignedV || IsSignedV, false, - std::is_floating_point_v || std::is_floating_point_v - ? 8 - : max(sizeof(A), sizeof(B)) > ::Type; -}; - template struct ResultOfBitNot { static constexpr PrimitiveType Type = Construct, false, sizeof(A)>::Type; }; -template -struct BinaryOperatorTraits { - using ColumnVectorA = typename PrimitiveTypeTraits::ColumnType; - using ColumnVectorB = typename PrimitiveTypeTraits::ColumnType; - using ArrayA = typename ColumnVectorA::Container; - using ArrayB = typename ColumnVectorB::Container; - using ArrayNull = PaddedPODArray; -}; - template /// 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 2fcb7f3c9c4a7e..a7a37f324d2ad1 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 a38c6c22104ab9..6428d6968e0d1f 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 117fb2539e2dee..2902d9a8f3075c 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 f9e77c952680ca..00000000000000 --- 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 6167b40124723c..68480cdbcb5e26 100644 --- a/be/src/core/value/map_value.h +++ b/be/src/core/value/map_value.h @@ -37,8 +37,6 @@ class MapValue { 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 e440bd53dc8afc..00000000000000 --- 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 dc9ff1426cfcc8..fa79a3e0a9bd87 100644 --- a/be/src/core/value/struct_value.h +++ b/be/src/core/value/struct_value.h @@ -41,8 +41,6 @@ class StructValue { return this->_has_null && this->_values[index] == nullptr; } - void shallow_copy(const StructValue* other); - const void** values() const { return const_cast(_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 2fc8df588e8413..494076f926f48b 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 5b0b55b183cea1..cfda0a4fb77d35 100644 --- a/be/src/util/cgroup_util.cpp +++ b/be/src/util/cgroup_util.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/be/test/core/block/block_test.cpp b/be/test/core/block/block_test.cpp index 12486d269f7a1c..1bb930bb15a6de 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({"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 9825f836186eb6..9f32156b855e39 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(); - // EXPECT_EQ(arr.size(), 1); - // EXPECT_EQ(arr[0].get(), 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(); - // EXPECT_EQ(arr2.size(), 1); - // EXPECT_EQ(arr2[0].get(), 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(); - // 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(); - // EXPECT_EQ(arr2.size(), 2); - // EXPECT_TRUE(arr2[0].is_null()); - // EXPECT_EQ(arr2[1].get(), 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 bc23518ff88afd..9e402179a63f04 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(), "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(), "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(), 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(), 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(), 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(), 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(), 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(), 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(), 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(), 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().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().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().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().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(), static_cast(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(), static_cast(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(), static_cast(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(), static_cast(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(); - EXPECT_EQ(static_cast(v), static_cast(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(); - EXPECT_EQ(static_cast(v), static_cast(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(); - EXPECT_EQ(static_cast(v), static_cast(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(); - EXPECT_EQ(static_cast(v), static_cast(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(); - EXPECT_EQ(static_cast(v), static_cast(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(); - 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(); - 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(); - 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(); - 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 e9f126faca0e2f..597623c1018bc9 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(0, true), "v"}); @@ -299,8 +291,6 @@ TEST(VariantUtilTest, ParseVariantColumns_DocModeBinaryToSubcolumns) { EXPECT_TRUE(st.ok()) << st.to_string(); const auto& out = assert_cast(*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(0, true), "v"});