HappenLee commented on code in PR #31913:
URL: https://github.com/apache/doris/pull/31913#discussion_r1527973974


##########
be/src/vec/aggregate_functions/aggregate_function_map.h:
##########
@@ -135,13 +135,44 @@ struct AggregateFunctionMapAggData {
                                                        num_rows);
         dst_key_column.get_nested_column().insert_range_from(*_key_column, 0, 
num_rows);
         dst.get_values().insert_range_from(*_value_column, 0, num_rows);
-        if (offsets.size() == 0) {
+        if (offsets.empty()) {
             offsets.push_back(num_rows);
         } else {
             offsets.push_back(offsets.back() + num_rows);
         }
     }
 
+    void write(BufferWritable& buf) const {
+        const size_t size = _key_column->size();
+        write_binary(size, buf);
+        for (size_t i = 0; i < size; i++) {
+            
write_binary(assert_cast<KeyColumnType&>(*_key_column).get_data_at(i), buf);
+        }
+        for (size_t i = 0; i < size; i++) {
+            write_binary(_value_column->get_data_at(i), buf);
+        }
+    }
+
+    void read(BufferReadable& buf) {
+        size_t size = 0;
+        read_binary(size, buf);
+        std::string keys;
+        for (size_t i = 0; i < size; i++) {
+            read_binary(keys, buf);
+            StringRef key {keys};
+            if (_map.find(key) != _map.cend()) {
+                continue;
+            }
+            key.data = _arena.insert(key.data, key.size);
+            assert_cast<KeyColumnType&>(*_key_column).insert_data(key.data, 
key.size);
+        }
+        std::string val;

Review Comment:
   same to up



-- 
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

Reply via email to