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

kxiao 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 7e3d6bc9f15 [Fix](Variant) Implement 
ColumnObject::update_hash_with_value (#27873)
7e3d6bc9f15 is described below

commit 7e3d6bc9f154a513adc50952efd78442fb70bc13
Author: lihangyu <[email protected]>
AuthorDate: Fri Dec 1 20:14:47 2023 +0800

    [Fix](Variant) Implement ColumnObject::update_hash_with_value (#27873)
---
 be/src/vec/columns/column.h          |  1 +
 be/src/vec/columns/column_object.cpp | 13 +++++++++++++
 be/src/vec/columns/column_object.h   |  6 +++---
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/columns/column.h b/be/src/vec/columns/column.h
index 9b49cce1c21..80c5803bff4 100644
--- a/be/src/vec/columns/column.h
+++ b/be/src/vec/columns/column.h
@@ -559,6 +559,7 @@ public:
     /// If the column contains subcolumns (such as Array, Nullable, etc), do 
callback on them.
     /// Shallow: doesn't do recursive calls; don't do call for itself.
     using ColumnCallback = std::function<void(WrappedPtr&)>;
+    using ImutableColumnCallback = std::function<void(const IColumn&)>;
     virtual void for_each_subcolumn(ColumnCallback) {}
 
     /// Columns have equal structure.
diff --git a/be/src/vec/columns/column_object.cpp 
b/be/src/vec/columns/column_object.cpp
index 20e2a771c42..1dd4f7c74cd 100644
--- a/be/src/vec/columns/column_object.cpp
+++ b/be/src/vec/columns/column_object.cpp
@@ -1440,4 +1440,17 @@ void ColumnObject::insert_indices_from_join(const 
IColumn& src, const uint32_t*
     }
 }
 
+void ColumnObject::update_hash_with_value(size_t n, SipHash& hash) const {
+    for_each_imutable_subcolumn(
+            [&](const auto& subcolumn) { return 
subcolumn.update_hash_with_value(n, hash); });
+}
+
+void ColumnObject::for_each_imutable_subcolumn(ImutableColumnCallback 
callback) const {
+    for (const auto& entry : subcolumns) {
+        for (auto& part : entry->data.data) {
+            callback(*part);
+        }
+    }
+}
+
 } // namespace doris::vectorized
diff --git a/be/src/vec/columns/column_object.h 
b/be/src/vec/columns/column_object.h
index 30c524555f5..7e8be7e6d81 100644
--- a/be/src/vec/columns/column_object.h
+++ b/be/src/vec/columns/column_object.h
@@ -410,14 +410,14 @@ public:
         return StringRef();
     }
 
+    void for_each_imutable_subcolumn(ImutableColumnCallback callback) const;
+
     const char* deserialize_and_insert_from_arena(const char* pos) override {
         LOG(FATAL) << "should not call the method in column object";
         return nullptr;
     }
 
-    void update_hash_with_value(size_t n, SipHash& hash) const override {
-        LOG(FATAL) << "should not call the method in column object";
-    }
+    void update_hash_with_value(size_t n, SipHash& hash) const override;
 
     void insert_data(const char* pos, size_t length) override {
         LOG(FATAL) << "should not call the method in column object";


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

Reply via email to