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

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

commit 4476944bdfe610676bbae06a40fe953ee6ae5d9c
Author: Jerry Hu <mrh...@gmail.com>
AuthorDate: Fri Aug 25 17:38:01 2023 +0800

    [fix](column) add unimplemented function of ColumnFixedLengthObject (#23468)
---
 be/src/vec/columns/column_fixed_length_object.h    |  3 ++-
 .../columns/column_fixed_length_object_test.cpp    | 27 ++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/columns/column_fixed_length_object.h 
b/be/src/vec/columns/column_fixed_length_object.h
index 05b0aea9f9..4f83e4308c 100644
--- a/be/src/vec/columns/column_fixed_length_object.h
+++ b/be/src/vec/columns/column_fixed_length_object.h
@@ -26,6 +26,7 @@
 #include "vec/common/arena.h"
 #include "vec/common/assert_cast.h"
 #include "vec/common/pod_array.h"
+#include "vec/common/sip_hash.h"
 
 namespace doris::vectorized {
 
@@ -169,7 +170,7 @@ public:
     }
 
     void update_hash_with_value(size_t n, SipHash& hash) const override {
-        LOG(FATAL) << "update_hash_with_value not supported";
+        hash.update(reinterpret_cast<const char*>(_data.data() + n * 
_item_size), _item_size);
     }
 
     [[noreturn]] ColumnPtr filter(const IColumn::Filter& filt,
diff --git a/be/test/vec/columns/column_fixed_length_object_test.cpp 
b/be/test/vec/columns/column_fixed_length_object_test.cpp
index d418a512e1..1f4b2d6d7f 100644
--- a/be/test/vec/columns/column_fixed_length_object_test.cpp
+++ b/be/test/vec/columns/column_fixed_length_object_test.cpp
@@ -25,6 +25,8 @@
 #include <memory>
 
 #include "gtest/gtest_pred_impl.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/sip_hash.h"
 
 namespace doris::vectorized {
 
@@ -54,4 +56,29 @@ TEST(ColumnFixedLenghtObjectTest, InsertRangeFrom) {
     }
 }
 
+TEST(ColumnFixedLenghtObjectTest, UpdateHashWithValue) {
+    auto column1 = ColumnFixedLengthObject::create(sizeof(size_t));
+    EXPECT_EQ(sizeof(size_t), column1->item_size());
+    const size_t count = 1000;
+
+    column1->resize(count);
+    auto& data = column1->get_data();
+    for (size_t i = 0; i < count; ++i) {
+        *((size_t*)&data[i * sizeof(size_t)]) = i;
+    }
+
+    SipHash hash1;
+    column1->update_hash_with_value(count, hash1);
+
+    auto column2 = ColumnVector<int64_t>::create();
+    column2->resize(count);
+    for (size_t i = 0; i != count; ++i) {
+        column2->get_data()[i] = i;
+    }
+
+    SipHash hash2;
+    column2->update_hash_with_value(count, hash2);
+
+    EXPECT_EQ(hash1.get64(), hash2.get64());
+}
 } // namespace doris::vectorized


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to