zclllyybb commented on code in PR #31163: URL: https://github.com/apache/doris/pull/31163#discussion_r1496805012
########## be/src/vec/columns/column.h: ########## @@ -395,6 +387,10 @@ class IColumn : public COW<IColumn> { LOG(FATAL) << get_name() << "update_crcs_with_value not supported"; } + virtual void update_hashes_with_value(uint64_t* __restrict hashes, Review Comment: dont move them ########## be/test/vec/columns/column_hash_func_test.cpp: ########## @@ -113,157 +84,4 @@ TEST(HashFuncTest, ArraySimpleBenchmarkTest) { std::cout << time_t << "ns" << std::endl; } -TEST(HashFuncTest, ArrayNestedArrayTest) { - DataTypes dataTypes = create_scala_data_types(); - - DataTypePtr d = std::make_shared<DataTypeInt64>(); - MutableColumnPtr scala_mutable_col = d->create_column(); - DataTypePtr nested_array_ptr = std::make_shared<DataTypeArray>(d); - DataTypePtr array_ptr = std::make_shared<DataTypeArray>(nested_array_ptr); - MutableColumnPtr array_mutable_col = array_ptr->create_column(); - - Array a, a1, a2, a3, nested, nested1; - nested.push_back(Int64(1)); - nested1.push_back(Int64(2)); - - // a: [[1], [2]] - a.push_back(nested); - a.push_back(nested1); - // a1: [[2], [1]] - a1.push_back(nested1); - a1.push_back(nested); - - // a2: [[], [1]] - a2.push_back(Array()); - a2.push_back(nested); - // a3: [[1], []] - a3.push_back(nested); - a3.push_back(Array()); - - array_mutable_col->insert(a); - array_mutable_col->insert(a1); - array_mutable_col->insert(a2); - array_mutable_col->insert(a3); - - auto nested_col = - reinterpret_cast<vectorized::ColumnArray*>(array_mutable_col.get())->get_data_ptr(); - EXPECT_EQ(nested_col->size(), 8); - - std::vector<uint64_t> xx_hash_vals(4); - std::vector<uint32_t> crc_hash_vals(4); - auto* __restrict xx_hashes = xx_hash_vals.data(); - auto* __restrict crc_hashes = crc_hash_vals.data(); - - // xxHash - EXPECT_NO_FATAL_FAILURE(array_mutable_col->update_hashes_with_value(xx_hashes)); - EXPECT_TRUE(xx_hashes[0] != xx_hashes[1]); - EXPECT_TRUE(xx_hashes[2] != xx_hashes[3]); - // crcHash - EXPECT_NO_FATAL_FAILURE( - array_mutable_col->update_crcs_with_value(crc_hashes, PrimitiveType::TYPE_ARRAY, 4)); - EXPECT_TRUE(crc_hashes[0] != crc_hashes[1]); - EXPECT_TRUE(crc_hashes[2] != crc_hashes[3]); -} - -TEST(HashFuncTest, ArrayCornerCaseTest) { - DataTypes dataTypes = create_scala_data_types(); - - DataTypePtr d = std::make_shared<DataTypeInt64>(); - DataTypePtr a = std::make_shared<DataTypeArray>(d); - MutableColumnPtr array_mutable_col = a->create_column(); - Array a1, a2; - a1.push_back(Int64(1)); - a1.push_back(Int64(2)); - a1.push_back(Int64(3)); - array_mutable_col->insert(a1); - array_mutable_col->insert(a1); - a2.push_back(Int64(11)); - a2.push_back(Int64(12)); - a2.push_back(Int64(13)); - array_mutable_col->insert(a2); - - EXPECT_EQ(array_mutable_col->size(), 3); - - std::vector<uint64_t> sip_hash_vals(3); - std::vector<uint64_t> xx_hash_vals(3); - std::vector<uint32_t> crc_hash_vals(3); - auto* __restrict sip_hashes = sip_hash_vals.data(); - auto* __restrict xx_hashes = xx_hash_vals.data(); - auto* __restrict crc_hashes = crc_hash_vals.data(); - - // sipHash - std::vector<SipHash> siphashs(3); - array_mutable_col->update_hashes_with_value(siphashs); - EXPECT_NO_FATAL_FAILURE(array_mutable_col->update_hashes_with_value(siphashs)); Review Comment: this -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org